mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Define help with keys This means that keys and help are automatically in sync This means that you can't define keys, but forget help This unfortunately also means that formatting may not be quite as good
20 lines
954 B
Go
20 lines
954 B
Go
package todoist
|
|
|
|
import "github.com/gdamore/tcell"
|
|
|
|
func (widget *Widget) initializeKeyboardControls() {
|
|
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
|
|
widget.SetKeyboardChar("c", widget.Close, "Close item")
|
|
widget.SetKeyboardChar("d", widget.Delete, "Delete item")
|
|
widget.SetKeyboardChar("h", widget.PreviousProject, "Select previous project")
|
|
widget.SetKeyboardChar("j", widget.Up, "Select previous item")
|
|
widget.SetKeyboardChar("k", widget.Down, "Select next item")
|
|
widget.SetKeyboardChar("l", widget.NextProject, "Select next project")
|
|
widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget")
|
|
|
|
widget.SetKeyboardKey(tcell.KeyDown, widget.Down, "Select next item")
|
|
widget.SetKeyboardKey(tcell.KeyLeft, widget.PreviousProject, "Select previous project")
|
|
widget.SetKeyboardKey(tcell.KeyRight, widget.NextProject, "Select next project")
|
|
widget.SetKeyboardKey(tcell.KeyUp, widget.Up, "Select previous item")
|
|
}
|