1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/modules/github/keyboard.go
Chris Cummer d6c8e08c2f Remove common functionality from KeyboardWidget and into Base
Signed-off-by: Chris Cummer <chriscummer@me.com>
2020-12-21 02:51:14 -08:00

27 lines
1.2 KiB
Go

package github
import (
"github.com/gdamore/tcell"
)
func (widget *Widget) initializeKeyboardControls() {
widget.InitializeHelpTextKeyboardControl(widget.ShowHelp)
widget.InitializeRefreshKeyboardControl(widget.Refresh)
widget.SetKeyboardChar("j", widget.Next, "Select next item")
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
widget.SetKeyboardChar("o", widget.openRepo, "Open item in browser")
widget.SetKeyboardChar("p", widget.openPulls, "Open pull requests in browser")
widget.SetKeyboardChar("i", widget.openIssues, "Open issues in browser")
widget.SetKeyboardKey(tcell.KeyDown, widget.Next, "Select next item")
widget.SetKeyboardKey(tcell.KeyUp, widget.Prev, "Select previous item")
widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next source")
widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous source")
widget.SetKeyboardKey(tcell.KeyEnter, widget.openPr, "Open PR in browser")
widget.SetKeyboardKey(tcell.KeyInsert, widget.openRepo, "Open item in browser")
widget.SetKeyboardKey(tcell.KeyEsc, widget.Unselect, "Clear selection")
}