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

Keep side context in context stack when pushing a main context

This fixes accordion mode for the commit files panel. When entering a file, the
commit files panel should stay expanded.
This commit is contained in:
Stefan Haller
2023-03-04 14:43:20 +01:00
parent 40a29fd622
commit 723504a290
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}
} else if c.GetKind() == types.MAIN_CONTEXT {
// 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 {
if stackContext.GetKind() == types.MAIN_CONTEXT {
contextsToDeactivate = append(contextsToDeactivate, stackContext)
} else {
contextsToKeep = append(contextsToKeep, stackContext)
}
}
gui.State.ContextManager.ContextStack = []types.Context{c}
gui.State.ContextManager.ContextStack = append(contextsToKeep, c)
} else {
topContext := gui.currentContextWithoutLock()