From f207f1d4d56d1012766e6206e713f2b3da70579d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 10:11:14 -0300 Subject: A column takes panes until their minimums fill it, not until none can be halved Placement halved the tallest pane or refused, so 11 panes filled 48 rows that hold 16 at their tag and two rows each: the refusal did not match the documented arithmetic. When no pane can be halved but the minimums with the new pane's fit, the column's rows are shared out again; and a refused pane's removal leaves no pane under its minimum. Co-Authored-By: Claude Opus 5.5 --- src/exec.zig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/exec.zig') diff --git a/src/exec.zig b/src/exec.zig index 79717963..60c4172d 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -977,9 +977,12 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan layout.snapColWeights(p, f.col); if (!layout.splitTallest(p, f.col, id) or !layout.placedRoomy(p, id, &before)) { if (layout.findPane(p, id) == null) layout.insert(p, f.col, p.col_n[f.col], id); + // No pane to halve, but the column holds every pane's minimum + // with the new one's: the rows are shared out again, so what is + // refused is only what the documented arithmetic cannot hold. // +Errors goes wherever there is room, last column first; with // none, its maker says the text some other way (appendErrors). - if (kind == .errors) { + if (layout.shareColumn(p, f.col)) {} else if (kind == .errors) { layout.removePane(p, id); var c = p.ncol; while (c > 0) { @@ -999,12 +1002,20 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan return; } } else { + // Refused, it closes at the step's end holding no weight, so + // its column's rows come back as they were, none rounded off. + p.panes[id].?.vweight = 0; p.unplaced.set(id); p.reportError(from, "placement", error.NoPaneRoom); return; } } }; + // Placed: no pane of its column left under its minimum by the rows + // rounding or an earlier placement gave it; shared out again if so. + if (layout.findPane(p, id)) |f| if (!layout.columnAtMinimums(p, f.col)) { + _ = layout.shareColumn(p, f.col); + }; if (kind == .command) return; tagline.exitHeader(p); p.active = id; -- cgit v1.3