Quality of Life update #4
|
@ -162,6 +162,15 @@ func scrollView(v *gocui.View, dy int) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func autoscroll(g *gocui.Gui, v *gocui.View) error {
|
||||
chatbox, err := g.View("chatbox")
|
||||
if err != nil {
|
||||
log.Panicf("Error happened setting autoscroll: %v\n", err)
|
||||
}
|
||||
chatbox.Autoscroll = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func initKeybindings(g *gocui.Gui) error {
|
||||
if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
|
||||
log.Panicln(err)
|
||||
|
@ -171,6 +180,10 @@ func initKeybindings(g *gocui.Gui) error {
|
|||
// log.Panicln(err)
|
||||
// }
|
||||
|
||||
if err := g.SetKeybinding("textarea", gocui.KeyCtrlA, gocui.ModNone, autoscroll); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
|
||||
if err := g.SetKeybinding("textarea", gocui.KeyEnter, gocui.ModNone, sendToServer); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
|
@ -222,7 +235,7 @@ func layout(g *gocui.Gui) error {
|
|||
if _, err := g.SetCurrentView("textarea"); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
textarea.Title = "Send message (Currently chatting as: " + Profile.Username + ")"
|
||||
textarea.Title = "(" + Profile.Username + ") " + "Send message" + " (Ctrl+A: Autoscroll)"
|
||||
textarea.Wrap = true
|
||||
textarea.Editable = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue