1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

move bindings to getKeybindings()

This commit is contained in:
Dawid Dziurla
2018-08-28 20:07:13 +02:00
parent 19a8029795
commit 741e28d01a

View File

@ -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