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