summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 23:37:04 -0300
committerGabriel Schneider <[email protected]>2026-11-24 23:42:03 -0300
commit2f3ba8edfa26eb9dad190da42ab6a1ac4f29ffd8 (patch)
tree4dd1efba4f1a1e4810347964b0bee11173467f13
parent5c938585963818743139439bfc5db6a15c90e10b (diff)
downloadpardes-2f3ba8edfa26eb9dad190da42ab6a1ac4f29ffd8.tar.gz
pardes-2f3ba8edfa26eb9dad190da42ab6a1ac4f29ffd8.zip
Trail: the walk drawn with a picker's list and the notice row in one tree, a test (walk UI G item 2e, SPEC §3.7's 'After ⏎' mockup and §6.7): B's walk, D's picker routing and C's notice row were each tested on their own line; a list asked from a held pane (SPC e's places, a server's answer) unrolls in its reader's tag, Enter steps the reader (another file: a pane of its own, the owner's word kept, no pane more), its word goes into the reader's trail before the place (`‹@pN › rank.zig:12 › Refs 1/2 › …/place.zig Keep`), the reader's tag is in the reading tint with Keep and the held one's is not, the notice row at the window's foot says where the reader's caret is (`…/place.zig:8`, nothing said), n walks the list (`Refs 2/2`, line 40); it passed as written once the reader's slot was read after the step: nothing to fix; the §3.7 rolled mockup's notice row is item 2a's test, the unrolled level A's, the picker's tag D's; tui core-test 1037/1206 (169 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--core/Trail.zig45
1 files changed, 45 insertions, 0 deletions
diff --git a/core/Trail.zig b/core/Trail.zig
index b5dff554..c6af03e5 100644
--- a/core/Trail.zig
+++ b/core/Trail.zig
@@ -623,6 +623,51 @@ test "the session of pick-ui §6.7: four jumps across three files, back by a cli
try std.testing.expectEqual(owner, p.panes[fresh].?.trail.steps[0].owner);
}
+test "the walk drawn with a picker's list and the notice row (walk UI G 2e, SPEC §3.7, §6.7): a list handed to a held pane lands in its reader, its word in the reader's trail before the place, the reader's tag in the reading tint with Keep, the held pane's not, n walking the list, the notice row at the foot saying where the caret is" {
+ var f: Fixture = .{ .p = undefined, .tmp = undefined };
+ try f.init(40);
+ defer f.deinit();
+ const p = f.p;
+ p.messages.live_len = 0;
+ const owner = p.panes[f.held].?.serial;
+ var buf: [4096 + 128]u8 = undefined;
+ var want: [4096 + 128]u8 = undefined;
+ // g d from the held pane: its reader, made below it.
+ f.look(f.held, "rank.zig", 12);
+ const r = p.view().active;
+ // A list asked from the held pane (SPC e's places, a server's answer):
+ // its Enter lands in the reader, nothing made.
+ const rows = try std.fmt.bufPrint(&buf, "{s}/place.zig:8:1 of\n{s}/place.zig:40:1 Span\n", .{ f.dir, f.dir });
+ pardes.Pick.open(p, f.held, .list, "Refs", "", rows);
+ try std.testing.expectEqual(p.panes[r].?.serial, p.view().tag_state.host);
+ pardes.Pick.landHere(p);
+ p.sync();
+ // The reader stepped (to another file: a pane of its own, its owner's
+ // word kept), no pane more.
+ var n: usize = 0;
+ for (p.panes) |slot| n += @intFromBool(slot != null);
+ try std.testing.expectEqual(@as(usize, 3), n);
+ const rd = p.view().active;
+ try std.testing.expect(rd != f.held and p.panes[r] == null);
+ try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, p.panes[rd].?), try std.fmt.bufPrint(&want, "‹@p{d} › rank.zig:12 › Refs 1/2 › {s}/place.zig Keep ", .{ owner, f.dir })));
+ var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
+ defer arena.deinit();
+ // The reader's tag in the reading tint, the held one's not; the notice
+ // row, nothing said, where the reader's caret is.
+ try std.testing.expectEqual(pardes.Color{ .rgb = p.chromeTheme().tag_reading_bg }, try tagGroundOf(p, &arena, rd));
+ try std.testing.expect(!std.meta.eql(pardes.Color{ .rgb = p.chromeTheme().tag_reading_bg }, try tagGroundOf(p, &arena, f.held)));
+ const s = try p.render(arena.allocator());
+ const foot = s.region(.notice_row, pardes.Region.none).?.rect;
+ var row: std.ArrayList(u8) = .empty;
+ for (0..s.cols) |x| try row.appendSlice(arena.allocator(), s.at(@intCast(x), foot.y).grapheme());
+ try std.testing.expect(std.mem.indexOf(u8, row.items, try std.fmt.bufPrint(&want, "{s}/place.zig:8", .{f.dir})) != null);
+ // n: the list's next place, in place of the current step.
+ typeKeys(p, "n");
+ p.sync();
+ try std.testing.expectEqual(@as(i32, 39), p.panes[rd].?.body.cur_row);
+ try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, p.panes[rd].?), "› Refs 2/2 ›") != null);
+}
+
test "a trail keeps its newest three back steps whole, older ones fold to ·, and a click on a · goes back to its step" {
var f: Fixture = .{ .p = undefined, .tmp = undefined };
try f.init(60);