summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context.go
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-03-04 14:43:20 +0100
committerStefan Haller <stefan@haller-berlin.de>2023-03-04 15:07:48 +0100
commit723504a290ca208c5ee8dc67c86b69b98cfbd069 (patch)
treeb2179df6d685d8fda94379c0b5f17caca0258a27 /pkg/gui/context.go
parent40a29fd622df85094f9982426437b30d0b603abc (diff)
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.
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r--pkg/gui/context.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index e4719ab13..61de2d8dc 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -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()