1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

switching repos without restarting the gui

This commit is contained in:
Jesse Duffield
2021-04-03 13:43:43 +11:00
parent bc9a99387f
commit f1d7f59e49
13 changed files with 182 additions and 113 deletions

View File

@ -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 {