diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-22 17:55:03 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-22 19:48:03 -0300 |
| commit | 8e850e6c923dcd84b7a5483f73377bd192b94a2b (patch) | |
| tree | 0730a84095f75d8a46e4dcdfebddb8d8b90af7c6 /core/Core.zig | |
| parent | bad506bd45846e012246a33b5d3097b3e92f02bc (diff) | |
| download | pardes-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 'core/Core.zig')
| -rw-r--r-- | core/Core.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/Core.zig b/core/Core.zig index 1dd03524..2d832f48 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -1973,7 +1973,7 @@ pub fn sync(p: *Pardes) void { // doc panes have no pty/emulator grid to reflow; just record // the size so bodyText renders the right number of rows if (pane.isTerminal()) { - pane.resizeGrid(cols, rows); + pane.resizeGrid(p.live, cols, rows); p.shell_rows.markStale(pane); // reflow moved every row p.emit(.{ .resize_pty = .{ .pane = .at(id), .cols = cols, .rows = rows } }); pane.fs.winsize = null; @@ -3865,11 +3865,11 @@ test "raw terminal cursor follows its active row only while that row is visible" try std.testing.expectEqual(rect.x + config.GUTTER + 3, live.x); try std.testing.expectEqual(body_y + 2, live.y); - pardes.Term.scroll(pane.terminal.?, -1); + pane.scrollBy(-1); const scrolled = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; try std.testing.expectEqual(live.x, scrolled.x); try std.testing.expectEqual(live.y + 1, scrolled.y); - pardes.Term.scroll(pane.terminal.?, -@as(i32, pane.rows)); + pane.scrollBy(-@as(i32, pane.rows)); try std.testing.expect((try p.render(frame.allocator())).cursor == null); pane.followOutput(); const returned = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; @@ -3919,31 +3919,31 @@ test "tty output follows only from the bottom" { p.update(.{ .output = .{ .pane = .at(shell), .bytes = std.fmt.bufPrint(&buf, "line {d}\r\n", .{i}) catch unreachable } }); } p.sync(); - const bottom = pardes.Term.grid(sp.terminal).offset; + const bottom = sp.termTop(); try std.testing.expect(bottom > 0); // Scrolled back, the reader stays put however much the shell prints. sp.scrollBy(-10); p.sync(); - const parked = pardes.Term.grid(sp.terminal).offset; + const parked = sp.termTop(); try std.testing.expect(parked < bottom); for (60..70) |i| { var buf: [32]u8 = undefined; p.update(.{ .output = .{ .pane = .at(shell), .bytes = std.fmt.bufPrint(&buf, "line {d}\r\n", .{i}) catch unreachable } }); } p.sync(); - try std.testing.expectEqual(parked, pardes.Term.grid(sp.terminal).offset); + try std.testing.expectEqual(parked, sp.termTop()); // Typing snaps back to live output, so nobody types blind. p.update(.{ .key = .{ .cp = 'x', .text = "x" } }); p.sync(); - try std.testing.expect(pardes.Term.grid(sp.terminal).offset > parked); + try std.testing.expect(sp.termTop() > parked); // ...and from there output follows again. - const live = pardes.Term.grid(sp.terminal).offset; + const live = sp.termTop(); p.update(.{ .output = .{ .pane = .at(shell), .bytes = "tail\r\n" } }); p.sync(); - try std.testing.expect(pardes.Term.grid(sp.terminal).offset > live); + try std.testing.expect(sp.termTop() > live); } test "an unasked desktop paste reaches a tty pane's program, not its buffer" { |
