Don't shrink the side panels in portrait mode when the main view is split

If the main view was split side by side, the side panels got only a
sixth of the space so that the two panes had more room. In portrait
mode the side panels are above the main view, so this made them lower
rather than narrower, and the main view gained no width. With the
default five side panels in a 20 row terminal, the files and branches
panels were squashed into a single row.

This could happen with mainPanelSplitMode set to horizontal, or with
portraitMode set to always in a terminal of at most 30 rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan HallerandClaude Opus 5.5 committed 2026-11-15 16:31:18 +01:00
1 parent fdc2b5be26
commit a0da44403a
2 files changed
+1 -27

No files matched your search

@@ -245,7 +245,7 @@ func getMidSectionWeights(args WindowArrangementArgs) (int, int) {
mainSectionWeight := int(math.Round(maxColumnCount * (1 - sidePanelWidthRatio)))
sideSectionWeight := int(math.Round(maxColumnCount * sidePanelWidthRatio))
if splitMainPanelSideBySide(args) {
if splitMainPanelSideBySide(args) && !shouldUsePortraitMode(args) {
mainSectionWeight = sideSectionWeight * 5 // need to shrink side panel to make way for main panels if side-by-side
}
@@ -545,7 +545,6 @@ func TestGetWindowDimensions(t *testing.T) {
args.UserConfig.Gui.MainPanelSplitMode = "horizontal"
args.MainPanes = types.BothMainPanes
},
/* EXPECTED:
expected: `
<status──────────────────────────────────────────>
╭files───────────────────────────────────────────╮
@@ -570,31 +569,6 @@ func TestGetWindowDimensions(t *testing.T) {
A: statusSpacer1
B: information
`,
ACTUAL: */
expected: `
<status──────────────────────────────────────────>
<fileshes────────────────────────────────────────>
<commits─────────────────────────────────────────>
<stash───────────────────────────────────────────>
╭main───────────────────╮╭secondary──────────────╮
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
╰───────────────────────╯╰───────────────────────╯
<options─────────────────────────────>A<B────────>
A: statusSpacer1
B: information
`,
},
{
name: "portrait auto mode, disabled because width is too large",