controller: add keybindings

pull/15/head
Edouard Paris 5 years ago
parent 884616fe40
commit 0453b712f5

@ -214,6 +214,11 @@ func (c *controller) setKeyBinding(g *gocui.Gui) error {
return err
}
err = g.SetKeybinding("", 'q', gocui.ModNone, quit)
if err != nil {
return err
}
err = g.SetKeybinding("", gocui.KeyArrowUp, gocui.ModNone, c.cursorUp)
if err != nil {
return err
@ -244,6 +249,11 @@ func (c *controller) setKeyBinding(g *gocui.Gui) error {
return err
}
err = g.SetKeybinding("", 'h', gocui.ModNone, c.Help)
if err != nil {
return err
}
return nil
}

@ -54,8 +54,10 @@ func (h Help) Set(g *gocui.Gui, x0, y0, x1, y1 int) error {
fmt.Fprintln(h.view, fmt.Sprintf("lntop %s - (C) 2019 Edouard Paris", version))
fmt.Fprintln(h.view, "Released under the MIT License")
fmt.Fprintln(h.view, "")
fmt.Fprintln(h.view, fmt.Sprintf("%5s %s",
color.Cyan("F1 h:"), "show this help screen"))
fmt.Fprintln(h.view, fmt.Sprintf("%6s %s",
color.Cyan("F1 h:"), "show/close this help screen"))
fmt.Fprintln(h.view, fmt.Sprintf("%6s %s",
color.Cyan("F10 q:"), "quit"))
_, err = g.SetCurrentView(HELP)
return err
}

Loading…
Cancel
Save