mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Clear keybinding functions in resetHelpersAndControllers
When switching to a repo that was open before, the context tree is reused, so before adding keybinding functions to those contexts again, we need to clear the old ones.
This commit is contained in:
@ -20,6 +20,10 @@ func (gui *Gui) Helpers() *helpers.Helpers {
|
||||
// in the keybinding menu: the earlier that the controller is attached to a context,
|
||||
// the lower in the list the keybindings will appear.
|
||||
func (gui *Gui) resetHelpersAndControllers() {
|
||||
for _, context := range gui.Contexts().Flatten() {
|
||||
context.ClearAllBindingsFn()
|
||||
}
|
||||
|
||||
helperCommon := gui.c
|
||||
recordDirectoryHelper := helpers.NewRecordDirectoryHelper(helperCommon)
|
||||
reposHelper := helpers.NewRecentReposHelper(helperCommon, recordDirectoryHelper, gui.onNewRepo)
|
||||
|
Reference in New Issue
Block a user