summaryrefslogtreecommitdiffstats
path: root/pkg/gui/arrangement.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-16 13:58:29 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commit7f89113245307be8a1642105014e9ce51a47210f (patch)
tree0b1237c4bdd4a465bedb7cc49c8372d0bfc46ea5 /pkg/gui/arrangement.go
parent0ea0c486310558e26af7ad6e4fcf17f57c2b62e3 (diff)
WIP
Diffstat (limited to 'pkg/gui/arrangement.go')
-rw-r--r--pkg/gui/arrangement.go33
1 files changed, 14 insertions, 19 deletions
diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go
index 25988bbd2..49311b6d4 100644
--- a/pkg/gui/arrangement.go
+++ b/pkg/gui/arrangement.go
@@ -244,27 +244,22 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
}
func (gui *Gui) currentCyclableViewName() string {
- currView := gui.g.CurrentView()
- currentCyclebleView := gui.State.PreviousView
- if currView != nil {
- viewName := currView.Name()
- usePreviousView := true
- for _, view := range gui.getCyclableViews() {
- if view == viewName {
- currentCyclebleView = viewName
- usePreviousView = false
- break
+ // there is always a cyclable context in the context stack. We'll look from top to bottom
+ for idx := range gui.State.ContextStack {
+ reversedIdx := len(gui.State.ContextStack) - 1 - idx
+ context := gui.State.ContextStack[reversedIdx]
+
+ if context.GetKind() == SIDE_CONTEXT {
+ viewName := context.GetViewName()
+
+ // unfortunate result of the fact that these are separate views, have to map explicitly
+ if viewName == "commitFiles" {
+ return "commits"
}
- }
- if usePreviousView {
- currentCyclebleView = gui.State.PreviousView
- }
- }
- // unfortunate result of the fact that these are separate views, have to map explicitly
- if currentCyclebleView == "commitFiles" {
- return "commits"
+ return viewName
+ }
}
- return currentCyclebleView
+ return "files" // default
}