summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-02-13 12:47:15 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit55af07a1bb4e1d3f85a456c2604c46e5535aca40 (patch)
treec5f671f3aaa8016687fbfa3fb3e635f1d4067337 /pkg/gui/context.go
parent33a223e9813daf426d033c07fce5a5fab4276653 (diff)
fix CI
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r--pkg/gui/context.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index 8d147f4c9..79f9acd94 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -43,13 +43,12 @@ func (gui *Gui) currentContextKeyIgnoringPopups() types.ContextKey {
// use replaceContext when you don't want to return to the original context upon
// hitting escape: you want to go that context's parent instead.
func (gui *Gui) replaceContext(c types.Context) error {
- gui.State.ContextManager.Lock()
- defer gui.State.ContextManager.Unlock()
-
if !c.IsFocusable() {
return nil
}
+ gui.State.ContextManager.Lock()
+
if len(gui.State.ContextManager.ContextStack) == 0 {
gui.State.ContextManager.ContextStack = []types.Context{c}
} else {
@@ -57,6 +56,8 @@ func (gui *Gui) replaceContext(c types.Context) error {
gui.State.ContextManager.ContextStack = append(gui.State.ContextManager.ContextStack[0:len(gui.State.ContextManager.ContextStack)-1], c)
}
+ defer gui.State.ContextManager.Unlock()
+
return gui.activateContext(c)
}