Don't show a transient view whose window is not part of the layout

With gui.sidePanels, a panel's gocui window is named after its first
tab, so when branches is grouped behind, say, worktrees, there is no
window called "branches" at all. The transient contexts
(remoteBranches, subCommits, commitFiles) initially point at the
windows "branches" and "commits", and layout() showed their views
whenever the window-to-view map named them as their window's current
view — without checking that the window exists in the layout. Since
the map is seeded from the contexts themselves, a window that no
panel owns keeps naming a transient view as its current view, and
that view had just been parked at full screen size (the fallback for
views in unlaid-out windows), so it covered every side panel below it
in z-order.

Only show a transient view if its window actually received dimensions
in this layout.

Fixes #5823.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-07-17 12:07:24 +02:00
co-authored by Claude Fable 5
parent 38e1fe0493
commit bf4f5827e7
3 changed files with 8 additions and 7 deletions
+8 -1
View File
@@ -154,7 +154,14 @@ func (gui *Gui) layout(g *gocui.Gui) error {
if err != nil && !errors.Is(err, gocui.ErrUnknownView) {
return err
}
view.Visible = gui.helpers.Window.GetViewNameForWindow(context.GetWindowName()) == context.GetViewName()
// A transient view is visible if it is the view its window is currently
// showing — but only if that window is part of the layout at all. For a
// window without dimensions, setViewFromDimensions parks the view at full
// screen size in the background, so making it visible would cover all
// windows below it.
_, windowHasDimensions := viewDimensions[context.GetWindowName()]
view.Visible = windowHasDimensions &&
gui.helpers.Window.GetViewNameForWindow(context.GetWindowName()) == context.GetViewName()
}
if gui.PrevLayout.Information != informationStr {
@@ -25,10 +25,7 @@ var BranchesNotFirstTab = NewIntegrationTest(NewIntegrationTestArgs{
// drilling into a remote or a branch; at startup both must be hidden,
// or they'd cover the side panels.
t.Views().RemoteBranches().
/* EXPECTED:
IsInvisible()
ACTUAL: */
IsVisible()
t.Views().SubCommits().IsInvisible()
},
})
@@ -24,9 +24,6 @@ var CommitsNotFirstTab = NewIntegrationTest(NewIntegrationTestArgs{
// The commit files view is only shown after drilling into a commit; at
// startup it must be hidden, or it'd cover the side panels.
t.Views().CommitFiles().
/* EXPECTED:
IsInvisible()
ACTUAL: */
IsVisible()
},
})