summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/panes.zig28
-rw-r--r--test/snapshots/cornerdrag.golden8
-rw-r--r--test/snapshots/shrinktag.golden20
-rw-r--r--test/snapshots/shrinktag.snap20
-rw-r--r--test/snapshots/splitparent.golden24
-rw-r--r--test/snapshots/splitparent.snap9
6 files changed, 70 insertions, 39 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);
}
diff --git a/test/snapshots/cornerdrag.golden b/test/snapshots/cornerdrag.golden
index 730cc2bf..30c1830a 100644
--- a/test/snapshots/cornerdrag.golden
+++ b/test/snapshots/cornerdrag.golden
@@ -243,7 +243,7 @@
|24:
|25:
|26:
-|27:
-|28:
-|29:
-|30: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter
+|27: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter
+|28: Collapse Del
+|29: w.txt
+|30:
diff --git a/test/snapshots/shrinktag.golden b/test/snapshots/shrinktag.golden
index 552722f9..9aa29e11 100644
--- a/test/snapshots/shrinktag.golden
+++ b/test/snapshots/shrinktag.golden
@@ -21,23 +21,25 @@
| ls
| w.txt
== snap shrunk grid=100x31 cursor=2,9
-|3: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo de Filter Collapse Del
-|4: de Filter Collapse Del ls
-|5: ls w.txt
-|6: w.txt
-|8:
+|4: w.txt ls
+|5: w.txt
+|6: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo
+|7: de Filter Collapse Del
+|8: ls
+|9: w.txt
|17:
|18:
|19:
|20:
== snap move-preview grid=100x31 cursor=2,9
-|8: ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
+|8: ls ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
== snap restored grid=100x31 cursor=2,9
-|3: de Filter Collapse Del de Filter Collapse Del
|4: ls ls
|5: w.txt w.txt
|6:
+|7:
|8: echo one; echo two
+|9:
|17: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo
|18: de Filter Collapse Del
|19: ls
@@ -47,4 +49,6 @@
|18:
|19:
|20:
-|30: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo
+|27: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo
+|28: de Filter Collapse Del
+|29: w.txt
diff --git a/test/snapshots/shrinktag.snap b/test/snapshots/shrinktag.snap
index 31edad14..5264be74 100644
--- a/test/snapshots/shrinktag.snap
+++ b/test/snapshots/shrinktag.snap
@@ -1,8 +1,8 @@
-# a pane can shrink to just its tagline: the pane below dragged by its grip up
-# to the tag row (0 body rows) -- a terminal has no rule between panes, so
-# the grip is the handle, as acme's button is -- the gutter box still grabs a
-# move, and dragging back down restores the body intact (the hidden pane's
-# pty/vt is never resized)
+# a terminal shrinks only to its tag and 2 body rows (a text pane would go
+# to its tag alone): the pane below dragged by its grip up to the tag row
+# stops there -- a terminal has no rule between panes, so the grip is the
+# handle, as acme's button is -- the gutter box still grabs a move, and
+# dragging back down restores the body intact
file w.txt x
start 31 100 -n 3
wait 8000 w.txt
@@ -18,7 +18,7 @@ key esc
settle 100
stable 400 5000
snap before
-# drag the lower pane's grip up under pane 0's tag row: tag-only pane
+# drag the lower pane's grip up under pane 0's tag row: it keeps 2 body rows
press left 1 18
drag left 1 3
release left 1 3
@@ -34,14 +34,16 @@ snap move-preview
drag left 20 3
release left 20 3
stable 400 5000
-# re-enlarge: the lower pane's grip, now under pane 0's tag, pulled back down
-press left 1 4
+# re-enlarge: the lower pane's grip, now under pane 0's 2 body rows, pulled
+# back down
+press left 1 7
drag left 1 18
release left 1 18
motion 40 25
stable 500 8000
snap restored
-# the bottom pane can shrink to ITS tag too: its grip dragged past the bottom
+# the bottom pane stops at ITS tag and 2 rows too: its grip dragged past the
+# bottom
press left 1 18
drag left 1 31
release left 1 31
diff --git a/test/snapshots/splitparent.golden b/test/snapshots/splitparent.golden
index 48dcf0c8..e626cea7 100644
--- a/test/snapshots/splitparent.golden
+++ b/test/snapshots/splitparent.golden
@@ -2,13 +2,16 @@
|Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Exit
| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol
| /tmp/pardes-snap/splitparent/cwd Tty+bash Save /tmp/pardes-snap/splitparent/cwd Tty+bash Save
-| /tmp/pardes-snap/splitparent/cwd Tty+bash Save Mode Filter Collapse Del
-| Mode Filter Collapse Del ls
+| Mode Filter Collapse Del Mode Filter Collapse Del
+| ls ls
+|
+| /tmp/pardes-snap/splitparent/cwd Tty+bash Save
+| Mode Filter Collapse Del
| ls
-== snap swap-parent grid=100x31 cursor=4,10
-|7: /tmp/pardes-snap/splitparent/cwd Tty+bash Save
-|8: Mode Filter Collapse Del
-|9: ls
+== snap swap-parent grid=100x31 cursor=4,13
+|10: /tmp/pardes-snap/splitparent/cwd Tty+bash Save
+|11: Mode Filter Collapse Del
+|12: ls
== snap tallest grid=100x6 cursor=4,5
|Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Exit
| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol
@@ -16,12 +19,15 @@
| /tmp/pardes-snap/splitparent/cwd Tty+bash Save Mode Filter Collapse Del
| /tmp/pardes-snap/splitparent/cwd Tty+bash Save ls
| e in that column: each keeps its tag and 2 rows
-== snap regrown grid=100x31 cursor=4,10
+== snap regrown grid=100x31 cursor=4,13
|Newcol Joincol Find Grep Help Changelog Tutor Dump NextColor Debug Exit
| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol
| /tmp/pardes-snap/splitparent/cwd Tty+bash Save /tmp/pardes-snap/splitparent/cwd Tty+bash Save
-| /tmp/pardes-snap/splitparent/cwd Tty+bash Save Mode Filter Collapse Del
-| Mode Filter Collapse Del ls
+| Mode Filter Collapse Del Mode Filter Collapse Del
+| ls ls
+|
+| /tmp/pardes-snap/splitparent/cwd Tty+bash Save
+| Mode Filter Collapse Del
| ls
|
| /tmp/pardes-snap/splitparent/cwd Tty+bash Save
diff --git a/test/snapshots/splitparent.snap b/test/snapshots/splitparent.snap
index 14391467..93ed9e21 100644
--- a/test/snapshots/splitparent.snap
+++ b/test/snapshots/splitparent.snap
@@ -1,4 +1,4 @@
-# a new pane never opens under a too-short parent: Alt-n from a tag-only pane
+# a new pane never opens under a too-short parent: Alt-n from a pane too short to halve
# splits the tall sibling in its column instead; when NO pane could leave the
# newcomer 2 body rows, the tallest one anywhere is split, and when that one
# cannot keep its own tag and 2 rows either, the pane is refused
@@ -6,15 +6,16 @@
config Placement pardes
start 31 100 -n 3
stable 700 20000
-# shrink pane 0 (top-left) to just its tagline: the pane below's grip dragged
-# up under it (a terminal has no rule between panes; the grip is the handle)
+# shrink pane 0 (top-left), a terminal, as far as it goes, its tag and 2 body
+# rows: the pane below's grip dragged up under its tag (a terminal has no
+# rule between panes; the grip is the handle)
press left 1 18
drag left 1 3
release left 1 3
motion 40 25
stable 500 8000
snap shrunk
-# Alt-n from the tag-only pane: the new shell opens below the tall sibling
+# Alt-n from the short pane: the new shell opens below the tall sibling
# underneath it, not as another 1-row sliver
key a-n
stable 700 15000