From 741e28d01a95a6bafa442d3642774b0f3817ff7f Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Tue, 28 Aug 2018 20:07:13 +0200 Subject: [PATCH] move bindings to getKeybindings() --- pkg/gui/keybindings.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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