summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 06:43:39 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit96383331f09e8af3fa24f767b3c56863309723b8 (patch)
tree12aa88b5e4832623de2c3a413b7b237f6ef34add /test/panes.zig
parent35e865eba278a1ef48a6ce160767d652a9c54ae8 (diff)
downloadpardes-96383331f09e8af3fa24f767b3c56863309723b8.tar.gz
pardes-96383331f09e8af3fa24f767b3c56863309723b8.zip
A terminal keeps its tag and two body rows through drags, squeezes and a smaller window
A terminal of one body row loses its prompt's mark and reads busy for ever. Placement already refused to make one that short; now layout never leaves one there either: a grip drag stops at the floor, and a column squeezed by weights or by the window takes the rows from its other panes. Text panes keep acme's way and can still be dragged to their tag, since acme has no terminals to follow. The shrinktag, splitparent and cornerdrag goldens are re-recorded for it, shrinktag's re-grab moved to where the grip now is. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig28
1 files changed, 23 insertions, 5 deletions
diff --git a/test/panes.zig b/test/panes.zig
index ca53af3d..42dd6b77 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -4891,7 +4891,7 @@ test {
_ = LookResetTests;
}
-test "a terminal's pty follows its pane down to its last row" {
+test "a terminal keeps its tag and two body rows through a squeeze, a drag and a smaller window; a text pane does not" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
p.presentation.enabled = false;
@@ -4903,16 +4903,34 @@ test "a terminal's pty follows its pane down to its last row" {
p.newScratchBelow(term);
p.sync();
while (p.nextEffect()) |_| {}
- // The terminal squeezed to its tag alone, folded by nobody.
+ const col = layout.findPane(p, term).?.col;
+ const floor = p.panes[term].?.tag_rows + layout.min_body_rows;
+ // Squeezed by the weights: the others give it its floor.
p.panes[term].?.vweight = 0.01;
- for (p.col_panes[0][0..p.col_n[0]]) |k| if (k != term) {
+ for (p.col_panes[col][0..p.col_n[col]]) |k| if (k != term) {
p.panes[k].?.vweight = 1000;
};
p.sync();
- try std.testing.expect(p.rects[term].h <= p.panes[term].?.tag_rows);
+ try std.testing.expectEqual(floor, p.rects[term].h);
var rows: ?u16 = null;
while (p.nextEffect()) |effect| if (effect == .resize_pty and effect.resize_pty.pane == term) {
rows = effect.resize_pty.rows;
};
- try std.testing.expectEqual(@as(?u16, 1), rows);
+ try std.testing.expectEqual(@as(?u16, layout.min_body_rows), rows);
+ // A drag of the grip under it up to its tag stops at the floor; one
+ // the other way takes a text pane down to its tag alone.
+ const k = layout.findPane(p, term).?.idx;
+ if (k + 1 < p.col_n[col]) {
+ layout.applyRowSplit(p, col, k, p.rects[term].y);
+ p.sync();
+ try std.testing.expectEqual(floor, p.rects[term].h);
+ const text = p.col_panes[col][k + 1];
+ layout.applyRowSplit(p, col, k, p.screen_h);
+ p.sync();
+ try std.testing.expect(p.rects[text].h <= p.panes[text].?.tag_rows);
+ }
+ // A window too short for all: the terminal keeps its floor still.
+ p.update(.{ .resize = .{ .cols = 100, .rows = 10 } });
+ p.sync();
+ try std.testing.expect(p.rects[term].h >= p.panes[term].?.tag_rows + layout.min_body_rows);
}