Enable ctrl+l & ctrl+u support

This commit is contained in:
Tony Blyler 2018-06-12 16:10:01 -04:00
parent 7824a86a23
commit 66c8c81810

16
main.go
View file

@ -128,9 +128,25 @@ func main() {
return nil return nil
}) })
gui.SetKeybinding("", gocui.KeyCtrlL, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
chat, err := g.View("chat")
if err != nil {
return nil
}
chat.SetCursor(0, 0)
chat.Clear()
return nil
})
gui.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error { gui.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit return gocui.ErrQuit
}) })
gui.SetKeybinding("input", gocui.KeyCtrlU, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
v.SetCursor(0, 0)
v.Clear()
return nil
})
gui.SetKeybinding("input", gocui.KeyEnter, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error { gui.SetKeybinding("input", gocui.KeyEnter, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
msg := v.ViewBuffer() msg := v.ViewBuffer()