diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-03 13:43:43 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-06 19:34:32 +1000 |
commit | f1d7f59e497a2da9066494d04f26e1ff00a0e4ee (patch) | |
tree | f51b629766de0778f4e6b9cd37f44af9db0edaad /pkg/gui/arrangement.go | |
parent | bc9a99387f68afb24863d17ab4d29c1686843a76 (diff) |
switching repos without restarting the gui
Diffstat (limited to 'pkg/gui/arrangement.go')
-rw-r--r-- | pkg/gui/arrangement.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index 3c6cbc5b9..422941243 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -181,9 +181,12 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map // the default behaviour when accordian mode is NOT in effect. If it is in effect // then when it's accessed it will have weight 2, not 1. func (gui *Gui) getDefaultStashWindowBox() *boxlayout.Box { + gui.State.ContextManager.Lock() + defer gui.State.ContextManager.Unlock() + box := &boxlayout.Box{Window: "stash"} stashWindowAccessed := false - for _, context := range gui.State.ContextStack { + for _, context := range gui.State.ContextManager.ContextStack { if context.GetWindowName() == "stash" { stashWindowAccessed = true } @@ -278,9 +281,12 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box { func (gui *Gui) currentSideWindowName() string { // there is always one and only one 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] + gui.State.ContextManager.Lock() + defer gui.State.ContextManager.Unlock() + + for idx := range gui.State.ContextManager.ContextStack { + reversedIdx := len(gui.State.ContextManager.ContextStack) - 1 - idx + context := gui.State.ContextManager.ContextStack[reversedIdx] if context.GetKind() == SIDE_CONTEXT { return context.GetWindowName() |