diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index c6decc24f..841c73f9b 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -12,7 +12,7 @@ type Binding struct { Modifier gocui.Modifier } -func (gui *Gui) keybindings(g *gocui.Gui) error { +func (gui *Gui) getKeybindings() []Binding { bindings := []Binding{ {ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: gui.quit}, {ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, Handler: gui.quit}, @@ -89,6 +89,12 @@ func (gui *Gui) keybindings(g *gocui.Gui) error { }...) } + return bindings +} + +func (gui *Gui) keybindings(g *gocui.Gui) error { + bindings := gui.getKeybindings() + for _, binding := range bindings { if err := g.SetKeybinding(binding.ViewName, binding.Key, binding.Modifier, binding.Handler); err != nil { return err