Size project panel to fit its rows when unfocused

Previously hard-coded to Size: 3 (one visible row) on the assumption
there was only ever one project. With profile pseudo-projects you can
have several rows, but they were hidden until you focused the panel.

Sizes to Len()+2 (rows plus borders), clamped to [3, 8] so the
single-project case is unchanged and a project with many profiles
can't squeeze out the other side panels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tim Abell 2026-05-20 11:44:19 +01:00
parent 9545538106
commit fb6f7fd380
No known key found for this signature in database
GPG key ID: E6545E4A512C39FA

View file

@ -175,13 +175,22 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
return defaultBox
}
// The project panel is compact (Size: 3) when not focused, but expands
// when focused to show the list of projects. This only applies when the
// project panel is actually visible (i.e. we are inside a compose project).
// The project panel sizes to fit its rows when not focused (so profiles
// are visible without having to click in), and expands by weight when
// focused. Capped so a project with many profiles can't crowd out the
// other side panels. This only applies when the project panel is
// actually visible (i.e. we are inside a compose project).
if len(sideWindowNames) > 0 && sideWindowNames[0] == "project" {
const maxUnfocusedSize = 8
size := gui.Panels.Projects.List.Len() + 2
if size < 3 {
size = 3
} else if size > maxUnfocusedSize {
size = maxUnfocusedSize
}
projectBox := &boxlayout.Box{
Window: sideWindowNames[0],
Size: 3,
Size: size,
}
if currentWindow == sideWindowNames[0] {
projectBox = &boxlayout.Box{