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

refactor keybindings

This commit is contained in:
Jesse Duffield
2022-02-05 10:31:07 +11:00
parent 2db4636815
commit 226985bf76
19 changed files with 215 additions and 201 deletions

View File

@ -581,14 +581,16 @@ func (gui *Gui) resetControllers() {
gui.helpers.Rebase.CheckMergeOrRebase,
)
submodulesController := controllers.NewSubmodulesController(
controllerCommon,
gui.State.Contexts.Submodules,
gui.git,
gui.enterSubmodule,
gui.getSelectedSubmodule,
)
gui.Controllers = Controllers{
Submodules: controllers.NewSubmodulesController(
controllerCommon,
gui.State.Contexts.Submodules,
gui.git,
gui.enterSubmodule,
gui.getSelectedSubmodule,
),
Submodules: submodulesController,
Files: controllers.NewFilesController(
controllerCommon,
gui.State.Contexts.Files,
@ -670,6 +672,17 @@ func (gui *Gui) resetControllers() {
),
Sync: syncController,
}
gui.State.Contexts.Submodules.AddKeybindingsFn(gui.Controllers.Submodules.GetKeybindings)
gui.State.Contexts.Files.AddKeybindingsFn(gui.Controllers.Files.GetKeybindings)
gui.State.Contexts.Tags.AddKeybindingsFn(gui.Controllers.Tags.GetKeybindings)
// TODO: commit to one name here: local commits or branch commits
gui.State.Contexts.BranchCommits.AddKeybindingsFn(gui.Controllers.LocalCommits.GetKeybindings)
gui.State.Contexts.BranchCommits.AddKeybindingsFn(gui.Controllers.Bisect.GetKeybindings)
gui.State.Contexts.Remotes.AddKeybindingsFn(gui.Controllers.Remotes.GetKeybindings)
gui.State.Contexts.Menu.AddKeybindingsFn(gui.Controllers.Menu.GetKeybindings)
gui.State.Contexts.Menu.AddKeybindingsFn(gui.Controllers.Menu.GetKeybindings)
// TODO: handle global contexts
}
var RuneReplacements = map[rune]string{