mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
fix cheatsheet crash
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/constants"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
@ -194,6 +195,16 @@ func (gui *Gui) noPopupPanel(f func() error) func() error {
|
||||
}
|
||||
}
|
||||
|
||||
// only to be called from the cheatsheet generate script. This mutates the Gui struct.
|
||||
func (self *Gui) GetCheatsheetKeybindings() []*types.Binding {
|
||||
self.helpers = helpers.NewStubHelpers()
|
||||
self.State = &GuiRepoState{}
|
||||
self.State.Contexts = self.contextTree()
|
||||
self.resetControllers()
|
||||
bindings, _ := self.GetInitialKeybindings()
|
||||
return bindings
|
||||
}
|
||||
|
||||
// renaming receiver to 'self' to aid refactoring. Will probably end up moving all Gui handlers to this pattern eventually.
|
||||
func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) {
|
||||
config := self.c.UserConfig.Keybinding
|
||||
@ -1306,8 +1317,6 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
||||
func (gui *Gui) resetKeybindings() error {
|
||||
gui.g.DeleteAllKeybindings()
|
||||
|
||||
bindings := gui.GetCustomCommandKeybindings()
|
||||
|
||||
bindings, mouseBindings := gui.GetInitialKeybindings()
|
||||
|
||||
// prepending because we want to give our custom keybindings precedence over default keybindings
|
||||
|
Reference in New Issue
Block a user