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/layout.go | |
parent | bc9a99387f68afb24863d17ab4d29c1686843a76 (diff) |
switching repos without restarting the gui
Diffstat (limited to 'pkg/gui/layout.go')
-rw-r--r-- | pkg/gui/layout.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 32ad1de85..a60a137af 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -216,11 +216,6 @@ func (gui *Gui) layout(g *gocui.Gui) error { } v.Frame = false v.FgColor = theme.OptionsColor - - // doing this here because it'll only happen once - if err := gui.onInitialViewsCreation(); err != nil { - return err - } } // this view takes up one character. Its only purpose is to show the slash when searching @@ -271,6 +266,14 @@ func (gui *Gui) layout(g *gocui.Gui) error { gui.State.OldInformation = informationStr } + if !gui.State.ViewsSetup { + if err := gui.onInitialViewsCreation(); err != nil { + return err + } + + gui.State.ViewsSetup = true + } + if gui.g.CurrentView() == nil { initialContext := gui.Contexts.Files if gui.State.Modes.Filtering.Active() { @@ -323,8 +326,13 @@ func (gui *Gui) layout(g *gocui.Gui) error { func (gui *Gui) onInitialViewsCreation() error { gui.setInitialViewContexts() - // add tabs to views + // hide any popup views. This only applies when we've just switched repos + for _, viewName := range gui.popupViewNames() { + _, _ = gui.g.SetViewOnBottom(viewName) + } + gui.g.Mutexes.ViewsMutex.Lock() + // add tabs to views for _, view := range gui.g.Views() { tabs := gui.viewTabNames(view.Name()) if len(tabs) == 0 { |