summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-05-16 20:24:17 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-05-16 21:01:38 +1000
commit00b03079d88464916528df720d8b85f08ce6a6a3 (patch)
tree3dd612a625b37a79148623a1c9b8f477275008dc /pkg/gui/context.go
parent95926866290980855dbefd16b503cb106e1c6171 (diff)
Don't deactivate context that you're about to activate
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r--pkg/gui/context.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index 7d3b32a1d..b55713f27 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -105,7 +105,9 @@ func (self *ContextMgr) pushToContextStack(c types.Context) ([]types.Context, ty
self.ContextStack = append(self.ContextStack, c)
} else if c.GetKind() == types.SIDE_CONTEXT {
// if we are switching to a side context, remove all other contexts in the stack
- contextsToDeactivate = self.ContextStack
+ contextsToDeactivate = lo.Filter(self.ContextStack, func(context types.Context, _ int) bool {
+ return context.GetKey() != c.GetKey()
+ })
self.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