Stop project panel from over-expanding on focus

Focus previously switched the box from Size to Weight: 2, giving the
panel ~2/7 of the side area regardless of how many rows it had. That
also ignored Gui.ExpandFocusedSidePanel — every other side panel only
expands on focus when accordion mode is on.

Route the project box through the same accordionBox helper as the
others. Stays fitted to content normally; expands on focus only when
the user opted in.

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

View file

@ -175,29 +175,25 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
return defaultBox return defaultBox
} }
// The project panel sizes to fit its rows when not focused (so profiles // The project panel sizes to fit its rows (so profiles are visible
// are visible without having to click in), and expands by weight when // without having to click in). Capped so a project with many profiles
// focused. Capped so a project with many profiles can't crowd out the // can't crowd out the other side panels. Routed through accordionBox
// other side panels. This only applies when the project panel is // so it follows the same focus-expansion rule as the other panels
// actually visible (i.e. we are inside a compose project). // (only expands on focus when Gui.ExpandFocusedSidePanel is set).
// 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" { if len(sideWindowNames) > 0 && sideWindowNames[0] == "project" {
const maxUnfocusedSize = 8 const maxProjectPanelSize = 8
size := gui.Panels.Projects.List.Len() + 2 size := gui.Panels.Projects.List.Len() + 2
if size < 3 { if size < 3 {
size = 3 size = 3
} else if size > maxUnfocusedSize { } else if size > maxProjectPanelSize {
size = maxUnfocusedSize size = maxProjectPanelSize
} }
projectBox := &boxlayout.Box{ projectBox := accordionBox(&boxlayout.Box{
Window: sideWindowNames[0], Window: sideWindowNames[0],
Size: size, Size: size,
} })
if currentWindow == sideWindowNames[0] {
projectBox = &boxlayout.Box{
Window: sideWindowNames[0],
Weight: 2,
}
}
return append([]*boxlayout.Box{ return append([]*boxlayout.Box{
projectBox, projectBox,