mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
move bindings to getKeybindings()
This commit is contained in:
@ -12,7 +12,7 @@ type Binding struct {
|
|||||||
Modifier gocui.Modifier
|
Modifier gocui.Modifier
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) keybindings(g *gocui.Gui) error {
|
func (gui *Gui) getKeybindings() []Binding {
|
||||||
bindings := []Binding{
|
bindings := []Binding{
|
||||||
{ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: gui.quit},
|
{ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: gui.quit},
|
||||||
{ViewName: "", Key: gocui.KeyCtrlC, 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 {
|
for _, binding := range bindings {
|
||||||
if err := g.SetKeybinding(binding.ViewName, binding.Key, binding.Modifier, binding.Handler); err != nil {
|
if err := g.SetKeybinding(binding.ViewName, binding.Key, binding.Modifier, binding.Handler); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user