summaryrefslogtreecommitdiff
path: root/test/behaviour
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 19:28:29 -0300
committerGabriel Schneider <[email protected]>2026-11-24 20:02:56 -0300
commitc40d447e63663d947f241d60a2bdb8ce1bd141c0 (patch)
tree93dcd149384624306166f1a7a6b5d75b138ca27c /test/behaviour
parentf26cf0be705280ff28ca69aaef6cc64e1466ed4e (diff)
downloadpardes-c40d447e63663d947f241d60a2bdb8ce1bd141c0.tar.gz
pardes-c40d447e63663d947f241d60a2bdb8ce1bd141c0.zip
messages: one notice row at the window's foot indexes the live messages, and the chips over the bodies go (pick-ui SPEC §10.3, walk UI line C item 2): the panes' area ends a row higher (layout.noticeRowHeight, none on a screen under 3 rows, as the column tags); the row is a header layer of its own (Layer.Kind.notice_row, NOTICE_ROW_LAYER, Region.Kind.notice_row) in the workspace tag's colours: on the left the message the row leads with (error > question > warn > notice > echo, the newest within a rank: its glyph in its kind's ink, its cause unless its words name it, its words without a host's clock stamp, ×n, its places as words), dimmed once its bright time is over; on the right +N more, N questions · SPC e, SPC e walk for an error with places, or N messages · SPC h m; with nothing live the focused pane's path:line (a terminal's directory); built each frame from the state (Messages.noticeRow, bounded by notice_row_cap), the left part giving way to the right; B2 runs and B3 Looks at a word on it (mouse.zig); Pane.Notices keeps the leader's and a prompt's chips only; a latent fault found by it: a kind's pane reopened (its file changed on disk, a Restore) kept the hashes of the views its old state was told, so the new state was never told its view and a PDF stayed blank until something moved its pane; the reloaded message's chip used to move it (Kind.reopen now tells a new state every view; behaviour addons_pdf's disk-change and Restore tests, failing before the fix); a message's cause for a kind's pane is its path; every frame changes (the foot row): boot's foot reads '/tmp/pardes-snap/boot/cwd', msg's 'repainted' '· saved /tmp/pardes-snap/msg/cwd/a.txt 2 messages · SPC h m' where a chip stood on the body's first row; the 98 tty goldens rewritten and read (57 the rows shifted alone, the rest the chips gone and racy shell output re-recorded; no file-written block and no snapshot's name changed), the four tty cases that click at fixed rows given a row more (chordcut, layout-open, images, respawn: their cursors unchanged), the addon scripts' outputs (fake, snake, life, pdf: windows a row shorter, the chip gone), hxdiff's core a row taller (22 rows as helix's), the tests over tiny screens a row taller, the drag edge of a bottom pane over the notice row (mouse.zig); tests: Messages.zig 'the notice row leads with the most important live message ...', 'a builtin announces itself on the notice row, an echo ...', draw.zig 'the word under the pointer on the notice row is lit ...', 'a message wider than the notice row ... gives way to the row's right end'; tui gate: core-test, pane-test, shell-test, behaviour-test (and --replay: 20 seeds, 0 failures), term-test, kitty-test pass; process-test 0 of 146 failed; the gui build is gated at the line's end
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/behaviour')
-rw-r--r--test/behaviour/keys.zig17
-rw-r--r--test/behaviour/placement.zig7
-rw-r--r--test/behaviour/tags.zig8
3 files changed, 22 insertions, 10 deletions
diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig
index e1f550e3..49c85512 100644
--- a/test/behaviour/keys.zig
+++ b/test/behaviour/keys.zig
@@ -353,6 +353,12 @@ test "keys: SPC j n from the pane a Look gave the keyboard walks back into the c
try std.testing.expect(std.mem.startsWith(u8, try s.read(sel), "Theme "));
}
+/// The screen as drawn, its notice row left out.
+fn panesShown(s: *Session) ![]const u8 {
+ const shown = try s.screen();
+ return shown[0 .. std.mem.lastIndexOfScalar(u8, shown, '\n') orelse shown.len];
+}
+
/// Screen row `row` as drawn.
fn screenRow(s: *Session, row: usize) ![]const u8 {
var rows = std.mem.splitScalar(u8, try s.screen(), '\n');
@@ -375,11 +381,12 @@ test "keys: a PDF in normal mode keeps : (its tag and back), SPC (a leader, canc
try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal "));
try s.keys(":");
try std.testing.expect(try s.cursor() == null);
- // The leader shows its keys until one it has not.
+ // The leader shows its keys until one it has not (over the panes: the
+ // notice row under them names SPC h m).
try s.keys(" ");
- try std.testing.expect(std.mem.indexOf(u8, try s.screen(), " SPC") != null);
+ try std.testing.expect(std.mem.indexOf(u8, try panesShown(&s), " SPC") != null);
try s.keys("!");
- try std.testing.expect(std.mem.indexOf(u8, try s.screen(), " SPC") == null);
+ try std.testing.expect(std.mem.indexOf(u8, try panesShown(&s), " SPC") == null);
try s.keys("/");
try std.testing.expect(try s.cursor() != null);
try std.testing.expectEqual(n, try s.focused());
@@ -393,9 +400,11 @@ test "keys: zz and zc put the cursor's line in the middle row of an odd view, as
for (&lines, 0..) |*l, i| _ = try std.fmt.bufPrint(l, "l{d:0>2}\n", .{i});
var s = try Session.initFile(std.testing.allocator, std.mem.asBytes(&lines));
defer s.deinit();
+ s.resize(80, 25);
for ([_][]const u8{ "15jzz", "ztzc" }) |keys| {
try s.keys(keys);
- // 80x24 gives the pane 21 rows: l05 to l25, l15 the eleventh
+ // 80x25 gives the pane 21 rows (the notice row under it): l05 to
+ // l25, l15 the eleventh
const top = (try s.where("l05"))[1];
try std.testing.expectEqual(top + 10, (try s.where("l15"))[1]);
try std.testing.expectEqual(top + 20, (try s.where("l25"))[1]);
diff --git a/test/behaviour/placement.zig b/test/behaviour/placement.zig
index 73d69883..05f730d1 100644
--- a/test/behaviour/placement.zig
+++ b/test/behaviour/placement.zig
@@ -69,7 +69,8 @@ test "placement: a look from a pane pane/new made after Delcol opens its file in
fn spans(s: *Session, comptime n: usize, names: [n][]const u8) ![n][2]usize {
var out: [n][2]usize = undefined;
for (names, 0..) |name, i| out[i][0] = try tagRow(s, name);
- const rows = std.mem.count(u8, try s.screen(), "\n") + 1;
+ // The last pane ends over the notice row.
+ const rows = std.mem.count(u8, try s.screen(), "\n");
for (0..n) |i| out[i][1] = (if (i + 1 < n) out[i + 1][0] else rows) - out[i][0];
return out;
}
@@ -131,8 +132,8 @@ test "placement: a look from the middle of a column splits only the pane it came
const names = [_][]const u8{ "/test.txt", "/mid", "/low", "/made" };
// The top and bottom panes dragged by their boxes to two and three
// rows, under a placement's minimum; the middle one full of text, so
- // the one halved.
- const rows = std.mem.count(u8, try s.screen(), "\n") + 1;
+ // the one halved. (The panes end over the notice row.)
+ const rows = std.mem.count(u8, try s.screen(), "\n");
const r = try spans(&s, 3, names[0..3].*);
try s.write("/mousein", s.at("m 0 {d} 1\nm 0 {d} 1\nm 0 {d} 0\n", .{ r[1][0], r[0][0] + 2, r[0][0] + 2 }));
try s.write("/mousein", s.at("m 0 {d} 1\nm 0 {d} 1\nm 0 {d} 0\n", .{ r[2][0], rows - 3, rows - 3 }));
diff --git a/test/behaviour/tags.zig b/test/behaviour/tags.zig
index 395b63c8..30895ad8 100644
--- a/test/behaviour/tags.zig
+++ b/test/behaviour/tags.zig
@@ -323,15 +323,17 @@ test "tags: a drafted name's edits are by grapheme, and an empty one is not comm
_ = try s.where("/café Save");
try s.keys("\x08");
_ = try s.where("/caf Save");
+ // (The tag, not the screen: the notice row says where the caret is.)
+ const tagfile = s.at("/pane/{d}/tag", .{n});
try s.keys("\x15\n");
- try std.testing.expectError(error.NotOnScreen, s.where("/test.txt"));
+ try std.testing.expect(std.mem.indexOf(u8, try s.read(tagfile), "/test.txt") == null);
try s.expect(s.at("/pane/{d}/name", .{n}), "/test.txt\n");
try s.expect(s.at("/pane/{d}/body", .{n}), "untouched\n");
// Esc keeps the draft pending; a second drops it.
try s.keys("\x1b");
- try std.testing.expectError(error.NotOnScreen, s.where("/test.txt"));
+ try std.testing.expect(std.mem.indexOf(u8, try s.read(tagfile), "/test.txt") == null);
try s.keys("\x1b");
- _ = try s.where("/test.txt");
+ try std.testing.expect(std.mem.indexOf(u8, try s.read(tagfile), "/test.txt") != null);
}
test "tags: leaving a pane or entering a header drops an uncommitted name" {