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

Merge pull request #2481 from stefanhaller/fix-accordion-mode-for-custom-patch

This commit is contained in:
Jesse Duffield 2023-03-06 17:32:28 +11:00 committed by GitHub
commit 3791b5057a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -78,12 +78,15 @@ func (gui *Gui) pushToContextStack(c types.Context) []types.Context {
gui.State.ContextManager.ContextStack = []types.Context{c} gui.State.ContextManager.ContextStack = []types.Context{c}
} else if c.GetKind() == types.MAIN_CONTEXT { } else if c.GetKind() == types.MAIN_CONTEXT {
// if we're switching to a main context, remove all other main contexts in the stack // if we're switching to a main context, remove all other main contexts in the stack
contextsToKeep := []types.Context{}
for _, stackContext := range gui.State.ContextManager.ContextStack { for _, stackContext := range gui.State.ContextManager.ContextStack {
if stackContext.GetKind() == types.MAIN_CONTEXT { if stackContext.GetKind() == types.MAIN_CONTEXT {
contextsToDeactivate = append(contextsToDeactivate, stackContext) contextsToDeactivate = append(contextsToDeactivate, stackContext)
} else {
contextsToKeep = append(contextsToKeep, stackContext)
} }
} }
gui.State.ContextManager.ContextStack = []types.Context{c} gui.State.ContextManager.ContextStack = append(contextsToKeep, c)
} else { } else {
topContext := gui.currentContextWithoutLock() topContext := gui.currentContextWithoutLock()

View File

@ -38,7 +38,7 @@ func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error)
// takes us from the patch building panel back to the commit files panel // takes us from the patch building panel back to the commit files panel
func (self *PatchBuildingHelper) Escape() error { func (self *PatchBuildingHelper) Escape() error {
return self.c.PushContext(self.contexts.CommitFiles) return self.c.PopContext()
} }
// kills the custom patch and returns us back to the commit files panel if needed // kills the custom patch and returns us back to the commit files panel if needed

View File

@ -162,7 +162,7 @@ func (self *MergeConflictsController) context() *context.MergeConflictsContext {
} }
func (self *MergeConflictsController) Escape() error { func (self *MergeConflictsController) Escape() error {
return self.c.PushContext(self.contexts.Files) return self.c.PopContext()
} }
func (self *MergeConflictsController) HandleEditFile() error { func (self *MergeConflictsController) HandleEditFile() error {

View File

@ -133,7 +133,7 @@ func (self *StagingController) EditFile() error {
} }
func (self *StagingController) Escape() error { func (self *StagingController) Escape() error {
return self.c.PushContext(self.contexts.Files) return self.c.PopContext()
} }
func (self *StagingController) TogglePanel() error { func (self *StagingController) TogglePanel() error {