summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 17:55:03 -0300
committerGabriel Schneider <[email protected]>2026-11-22 19:48:03 -0300
commit8e850e6c923dcd84b7a5483f73377bd192b94a2b (patch)
tree0730a84095f75d8a46e4dcdfebddb8d8b90af7c6 /test/panes.zig
parentbad506bd45846e012246a33b5d3097b3e92f02bc (diff)
downloadpardes-8e850e6c923dcd84b7a5483f73377bd192b94a2b.tar.gz
pardes-8e850e6c923dcd84b7a5483f73377bd192b94a2b.zip
terminals: where a view stands in a terminal's history is the view's, not the emulator's (pardes-term-join-10, item 1; the note's point 3, the coordinator's choice): `Pane.scrolled_to` (core/panes.zig), a per-view field (views.zig `pane_fields`, `PaneView`: in the rollback copy, the digest and the dump, each view's own), the row its top shows or null on the output, written only by a step (`scrollBy`, `followOutput`), and carried with every open view's through each write of the emulator that moves rows, once, in the confirmed unit's apply, on every side alike (`Term.feed`/`Term.resize` take the places; core/term/terminal.zig `carry`/`carried` pin each place's row on the primary screen and read the pin back: up by the rows the history drops, 0 when its own row goes, null in the active area or after a reset: a function of the fed bytes); the draw reads the rows from the view's place (`viewport`, `paint`, `ImagesAt.place`, terminal.zig `shown`), and ghostty's own viewport is never moved, read, digested or dumped (`Grid.offset`/`view`, `Parts.view` and the digest's offset gone): two clients no longer scroll one viewport (the new views.zig test failed on the base, `expected 80, found 77`), and a speculation's scroll is in the copy, so `putViews`, the view half of `keepViews` (now `keepSerials`), `viewTo`/`scroll`/`follow` (ops, wrappers, bodies), the Debug screen hash's view exclusion, `reflow`'s column-0 cure and `feedOutput`'s follow-after-read are deleted, and S1's `calls` lists no view write (the rows `viewTo`, `scroll`, `follow` gone); tests: the two-view test (with a dump), the place at the history's cap (`setMaxBytes(1)`), a 300-seed fuzz of the carried place against ghostty's own pinned view, a client's wheel over a shared terminal through output and a rollback, round 6's order explorer (30 seeds a run); the wire at 31 (abi/wire.zig, test/daemon.py `WIRE`): an installed build's dump loads with every view on the output; IN THE WORKSPACE core-test 912/1072 (160 skipped), shell-test 1114/1117 (3 skipped), term-test 16/16, kitty-test 45/45, pane-test 181/182, behaviour-test 275/275, --replay 275/275, process-test 0 of 146 failed, as pairs 0 of 146; gui unit-test 1707/1711, its one error BaselineHarnessMismatch (every base's)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 32cfd530..0a0bd3f9 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -965,7 +965,7 @@ test "terminal overlay recoloring never materializes unrelated history" {
_ = try p.render(frame.allocator());
try testing.expect(p.shell_rows.pane == null);
- pane.ovl.?.row = @intCast(pardes.Term.grid(pane.terminal).offset);
+ pane.ovl.?.row = @intCast(pane.termTop());
p.gpa.free(pane.ovl.?.text);
pane.ovl.?.text = try p.gpa.dupe(u8, "caf\xc3\xa9 \xe7\x95\x8c");
_ = frame.reset(.retain_capacity);
@@ -994,8 +994,8 @@ test "terminal output keeps following new rows after scrollback eviction" {
for (0..3) |phase| {
if (phase > 0) {
pane.body.mode = .normal;
- pardes.Term.scroll(pane.terminal.?, -30);
- try std.testing.expect(pages.scrollbar().offset < pages.scrollbar().total - pane.rows);
+ pane.scrollBy(-30);
+ try std.testing.expect(pane.termTop() < pages.scrollbar().total - pane.rows);
pardes.keys.enterTty(p, 0);
}
for (phase * 20_000..(phase + 1) * 20_000) |n| {
@@ -1008,7 +1008,7 @@ test "terminal output keeps following new rows after scrollback eviction" {
try std.testing.expect(evictions > phase);
try std.testing.expect(pages.page_size <= pages.limits.max(.bytes));
const sb = pages.scrollbar();
- try std.testing.expectEqual(sb.total - pane.rows, sb.offset);
+ try std.testing.expectEqual(sb.total - pane.rows, pane.termTop());
const full = try pardes.Term.scrollback(pane.terminal, gpa);
defer gpa.free(full);
var last_buf: [16]u8 = undefined;
@@ -2686,14 +2686,14 @@ const TerminalTests = struct {
p.update(.{ .output = .{ .pane = .at(0), .bytes = bytes } });
}
p.shell_rows.stale = true;
- pardes.Term.scroll(pane.terminal.?, -20);
+ pane.scrollBy(-20);
// ONE buffer line standing in for SIX shell rows: everything below slides
// UP five, so the last rows of the body resolve past the viewport's bottom
// edge. `PageList.pin` answers for those rows anyway — it walks down the
// pagelist, not the viewport — so without a bound of its own this pass
// painted the scrollback's colours onto rows the text pass left blank.
- const anchor: i32 = @intCast(pardes.Term.grid(pane.terminal).offset);
+ const anchor: i32 = @intCast(pane.termTop());
pane.ovl = .{ .row = anchor, .rows = 6, .text = try p.gpa.dupe(u8, "one") };
p.shell_rows.stale = true;
@@ -2958,7 +2958,7 @@ const TerminalTests = struct {
// a buffer whose covered span STRADDLES the viewport top is an ordinary
// state. tty mode does not apply the buffer, so it must not be moved by one
// either — and `surfRow`/`gridRow` are not inverses across that span.
- const anchor: i32 = @intCast(pardes.Term.grid(pane.terminal).offset);
+ const anchor: i32 = @intCast(pane.termTop());
pane.ovl = .{ .row = anchor - 1, .rows = 4, .text = try p.gpa.dupe(u8, "one\ntwo") };
p.shell_rows.stale = true;
_ = frame.reset(.retain_capacity);