From 1f035a8d6d318c84e8d7ec47cb3d9ba3a1b5f961 Mon Sep 17 00:00:00 2001 From: Tim Abell Date: Wed, 20 May 2026 12:22:13 +0100 Subject: [PATCH] Stop project panel from over-expanding on focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- pkg/gui/arrangement.go | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go index 18de4ae8..8ac01024 100644 --- a/pkg/gui/arrangement.go +++ b/pkg/gui/arrangement.go @@ -175,29 +175,25 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box { return defaultBox } - // 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). + // The project panel sizes to fit its rows (so profiles are visible + // without having to click in). Capped so a project with many profiles + // can't crowd out the other side panels. Routed through accordionBox + // so it follows the same focus-expansion rule as the other panels + // (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" { - const maxUnfocusedSize = 8 + const maxProjectPanelSize = 8 size := gui.Panels.Projects.List.Len() + 2 if size < 3 { size = 3 - } else if size > maxUnfocusedSize { - size = maxUnfocusedSize + } else if size > maxProjectPanelSize { + size = maxProjectPanelSize } - projectBox := &boxlayout.Box{ + projectBox := accordionBox(&boxlayout.Box{ Window: sideWindowNames[0], Size: size, - } - if currentWindow == sideWindowNames[0] { - projectBox = &boxlayout.Box{ - Window: sideWindowNames[0], - Weight: 2, - } - } + }) return append([]*boxlayout.Box{ projectBox,