diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 10:11:14 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | f207f1d4d56d1012766e6206e713f2b3da70579d (patch) | |
| tree | 307fb71b210cb4757f2d3fa56094effe20e4d3cf /src/ninep/ctl.zig | |
| parent | df6106af80e13cc4f0121b7f2caf5315a4453a9d (diff) | |
| download | pardes-f207f1d4d56d1012766e6206e713f2b3da70579d.tar.gz pardes-f207f1d4d56d1012766e6206e713f2b3da70579d.zip | |
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 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index fbda6113..6631e5f9 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -2088,6 +2088,24 @@ test "a bad event record says what is wrong with it" { _ = call(p, .{ .tag = 3, .op = .release, .node = event, .handle = h }); } +test "a column takes panes until their documented minimums fill it, not until none can be halved" { + const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 50 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const new = @intFromEnum(tree.TopFile.new); + while (call(p, .{ .tag = 1, .op = .open, .node = new }).reply.status == .ok) p.sync(); + p.sync(); + const avail = p.screen_h - (p.topBarHeight() + p.columnBarHeight()); + for (0..p.ncol) |c| { + var need: u32 = 0; + for (p.col_panes[c][0..p.col_n[c]]) |k| need += layout.minRows(p, k); + // Refused only when one more pane's tag and two rows would not fit. + if (p.col_n[c] > 1) try testing.expect(avail - need < 3); + // Every pane keeps its minimum. + for (p.col_panes[c][0..p.col_n[c]]) |k| try testing.expect(p.rects[k].h >= layout.minRows(p, k)); + } +} + test "size is monotonic: growing is never refused, and a size once taken is taken again" { const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 }); defer p.deinit(); |
