summaryrefslogtreecommitdiff
path: root/test/kitty.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 03:44:57 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commita22b579ad2df8d1811f0e194fa1bbc06e2282cf8 (patch)
tree9dcaaa6d17c6c67048b58456dcd9dbdb74b9fc9a /test/kitty.zig
parenta3509e4df5efc94b0deee3b06dd72f85b0d96647 (diff)
downloadpardes-a22b579ad2df8d1811f0e194fa1bbc06e2282cf8.tar.gz
pardes-a22b579ad2df8d1811f0e194fa1bbc06e2282cf8.zip
term: the terminal a module of its own (docs/next-terminal.md, Phase 1): src/term/term.zig roots it, importing std, ghostty-vt, wuffs, zstbi and plain, never the core, and gives the core one table, `ops` (plain.term.Ops: about 60 entries, the records they take and give and the opaque handles State, Encoder, Track and Replica, in src/plain/term.zig), its own functions put in it through a cast refused at compile time unless each parameter and result matches the table's but for the handles and every error is one the table names; src/Term.zig, the core's side, takes `ops` from the term module when the build's term_options say the core has one (every core module but core-test's), null otherwise, and Term.State is a handle with the walk's hooks, so a dump keeps a terminal as it did (its Parts by name through walk.save, then ghostty's snapshot) and the digest is the emulator's; echo.zig comes back to the core (src/echo.zig: predicted echo is the replica's presentation, its five reads of the emulator through Term.grid, modes, prompt and Term.echoCell); screen_state's Peer is a plain record both sides name (its noteSent a function of screen_state's), its Encoder, Track and Replica handles made and freed through the table (replica.Screens makes its encoder at the first encode); a prompt's cut is told in columns and measured in its row's text by the core (Term.promptPrefix, File.rawAtDisplay); TerminalImages' decode bound moves from memory.limits to the decoder it bounds; build.zig: core_lean, the core module without the terminal, is core-test's, and wireCore no longer gives any core module ghostty-vt, wuffs or zstbi (the term module has them), so core-test's compile names none of ghostty, wuffs, zstbi, simdutf, highway or -lc++ (from --verbose); term-test runs the module's own tests (the pager's, screen_state's, the luminance table's); the tests of a terminal through a core move as they were to test/terminal.zig, in pane-test, which imports both (`of` reads the emulator behind a handle; the dump round trip frees through State.dumpFree), and tests elsewhere that read the emulator do it through Term.emulatorOf, a test in core-test skipping first; core-test skips a test whose terminal Term.open refuses; Authority.init releases its tape when the core it boots fails (it leaked); tests: core-test (no terminal) 409 of 941, 532 skipped, shell-test (the same tests with the terminal) 984 of 984, pane-test 180 of 181 (1 skipped, as before), term-test 15 of 15, kitty-test 45 of 45, replicas checked/wrong 0, hxdiff 658 cases 0 mismatches, behaviour-test 268 of 272 (the base's four addon ABI tests), lib-test
Diffstat (limited to 'test/kitty.zig')
-rw-r--r--test/kitty.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/kitty.zig b/test/kitty.zig
index 760d22be..1ba96745 100644
--- a/test/kitty.zig
+++ b/test/kitty.zig
@@ -116,8 +116,8 @@ const Rig = struct {
return r.p.panes[id].?;
}
- fn vt(r: *Rig, id: u8) @TypeOf(&r.pane(id).terminal.?.vt) {
- return &r.pane(id).terminal.?.vt;
+ fn vt(r: *Rig, id: u8) @TypeOf(&pardes.Term.emulatorOf(r.pane(id).terminal.?).vt) {
+ return &pardes.Term.emulatorOf(r.pane(id).terminal.?).vt;
}
fn storage(r: *Rig, id: u8) @TypeOf(&r.vt(id).screens.active.kitty_images) {
@@ -133,7 +133,7 @@ const Rig = struct {
/// The id its program gave the image a place draws.
fn idOf(r: *Rig, place: pardes.Placement) ?u32 {
const shown = r.p.panes[place.pane] orelse return null;
- var it = shown.terminal.?.vt.screens.active.kitty_images.images.iterator();
+ var it = pardes.Term.emulatorOf(shown.terminal.?).vt.screens.active.kitty_images.images.iterator();
while (it.next()) |e| if (pardes.Placement.keyOf(shown.serial, e.key_ptr.*, @truncate(e.value_ptr.generation)) == place.key) return e.key_ptr.*;
return null;
}
@@ -727,7 +727,7 @@ test "kitty: answers past what one read may hold are dropped whole, never cut" {
r.feed(0, batch.items);
const got = try r.take(0);
try std.testing.expect(got.len > 0);
- try std.testing.expect(r.pane(0).terminal.?.reply_dropped > 0);
+ try std.testing.expect(pardes.Term.emulatorOf(r.pane(0).terminal.?).reply_dropped > 0);
// Whole sequences only, each its own `ESC _ G ... ESC \`.
var rest = got;
while (rest.len > 0) {
@@ -1306,7 +1306,7 @@ test "kitty: a dumped and restored terminal keeps its images" {
defer restored.deinit();
const pane = restored.panes[0].?;
// ghostty's snapshot of the emulator (src/term/terminal.zig) carries them.
- try std.testing.expect(pane.terminal.?.vt.screens.active.kitty_images.placements.count() > 0);
+ try std.testing.expect(pardes.Term.emulatorOf(pane.terminal.?).vt.screens.active.kitty_images.placements.count() > 0);
}
// ---- Real clients' traffic ----