diff --git a/pkg/gui/layout.go b/pkg/gui/layout.go index 4e6959281..f2e48c674 100644 --- a/pkg/gui/layout.go +++ b/pkg/gui/layout.go @@ -2,10 +2,8 @@ package gui import ( "github.com/jesseduffield/gocui" - "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/samber/lo" - "golang.org/x/exp/slices" ) // layout is called for every screen re-render e.g. when the screen is resized @@ -244,25 +242,6 @@ func (gui *Gui) onRepoViewReset() error { } } - gui.g.Mutexes.ViewsMutex.Lock() - // add tabs to views - for _, view := range gui.g.Views() { - // if the view is in our mapping, we'll set the tabs and the tab index - for _, values := range gui.viewTabMap() { - index := slices.IndexFunc(values, func(tabContext context.TabView) bool { - return tabContext.ViewName == view.Name() - }) - - if index != -1 { - view.Tabs = lo.Map(values, func(tabContext context.TabView, _ int) string { - return tabContext.Tab - }) - view.TabIndex = index - } - } - } - gui.g.Mutexes.ViewsMutex.Unlock() - return nil } diff --git a/pkg/gui/views.go b/pkg/gui/views.go index 05692aa48..d13dee7f4 100644 --- a/pkg/gui/views.go +++ b/pkg/gui/views.go @@ -4,8 +4,10 @@ import ( "fmt" "github.com/jesseduffield/gocui" + "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/theme" "github.com/samber/lo" + "golang.org/x/exp/slices" ) type viewNameMapping struct { @@ -234,4 +236,20 @@ func (gui *Gui) configureViewProperties() { gui.Views.Stash.TitlePrefix = "" } + + for _, view := range gui.g.Views() { + // if the view is in our mapping, we'll set the tabs and the tab index + for _, values := range gui.viewTabMap() { + index := slices.IndexFunc(values, func(tabContext context.TabView) bool { + return tabContext.ViewName == view.Name() + }) + + if index != -1 { + view.Tabs = lo.Map(values, func(tabContext context.TabView, _ int) string { + return tabContext.Tab + }) + view.TabIndex = index + } + } + } }