mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 15:11:02 +00:00
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:
parent
fb6f7fd380
commit
1f035a8d6d
1 changed files with 12 additions and 16 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue