1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-01 22:52:01 +02:00

refactor custom commands panel

This commit is contained in:
Jesse Duffield
2022-02-13 19:15:22 +11:00
parent c685a413c9
commit 85f2319897
2 changed files with 101 additions and 80 deletions

View File

@@ -256,6 +256,13 @@ func (gui *Gui) handleToggleCommitFileDirCollapsed() error {
return nil
}
// NOTE: this is very similar to handleToggleFileTreeView, could be DRY'd with generics
func (gui *Gui) handleToggleCommitFileTreeView() error {
gui.State.Contexts.CommitFiles.CommitFileTreeViewModel.ToggleShowTree()
return gui.c.PostRefreshUpdate(gui.State.Contexts.CommitFiles)
}
func (gui *Gui) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesContextOpts) error {
// sometimes the commitFiles view is already shown in another window, so we need to ensure that window
// no longer considers the commitFiles view as its main view.
@@ -273,10 +280,3 @@ func (gui *Gui) SwitchToCommitFilesContext(opts controllers.SwitchToCommitFilesC
return gui.c.PushContext(gui.State.Contexts.CommitFiles)
}
// NOTE: this is very similar to handleToggleFileTreeView, could be DRY'd with generics
func (gui *Gui) handleToggleCommitFileTreeView() error {
gui.State.Contexts.CommitFiles.CommitFileTreeViewModel.ToggleShowTree()
return gui.c.PostRefreshUpdate(gui.State.Contexts.CommitFiles)
}