summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-19 08:04:39 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commitf0c3d3fc4d43f5b7487540d5c0356f62b3b2997d (patch)
tree2e2131bc7a05b2a2dca5c1387932e51dcb988685 /pkg/gui/context.go
parent2488e0044d2ca22f463291f6db06a61c79bd5ff0 (diff)
centralise setting of main views context
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r--pkg/gui/context.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index 1e466151e..522932664 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -1,6 +1,8 @@
package gui
import (
+ "fmt"
+
"github.com/jesseduffield/gocui"
)
@@ -104,6 +106,10 @@ func (gui *Gui) switchContext(c Context) error {
gui.State.ContextStack = append(gui.State.ContextStack, c)
}
+ if c.GetViewName() == "main" {
+ gui.changeMainViewsContext(c.GetKey())
+ }
+
return gui.activateContext(c)
})
@@ -422,6 +428,8 @@ func (gui *Gui) changeMainViewsContext(context string) {
case "normal", "patch-building", "staging", "merging":
gui.getMainView().Context = context
gui.getSecondaryView().Context = context
+ default:
+ panic(fmt.Sprintf("unknown context for main: %s", context))
}
gui.State.MainContext = context