diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-28 21:03:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-28 21:23:53 -0300 |
| commit | b250eb6135475699a945324c005890e8e1b4dd0b (patch) | |
| tree | c32f06f89cdbd501ba5d75dc8ba80ecebbe3c278 /build.zig | |
| parent | a48a825b06cc45947adaecf42073ed86af8b7a2d (diff) | |
| download | pardes-b250eb6135475699a945324c005890e8e1b4dd0b.tar.gz pardes-b250eb6135475699a945324c005890e8e1b4dd0b.zip | |
kitty graphics conformance for terminal panes: a core suite (test/kitty.zig, `zig build kitty-test`, in unit-test) and an end-to-end harness (`zig build kitty-harness`, tty and gui); four gaps it found fixed, one left
The core suite feeds a pane's output as pty reads do and checks what the program reads back, ghostty's image storage and the ImagePlaces a frame draws: queries and their errors, q=0/1/2, f=24/32/100 and o=z, chunked m=1 split at every read size, t=f/t=t/t=s, a=T and C=1 cursor movement, a=p by placement id with source rects and re-puts, image numbers, every d= delete (a/A i/I n/N c/C p/P q/Q x/X y/Y z/Z r/R) and a delete abandoning a chunked load, Unicode placeholders over two rows with implicit columns and a placement named in the underline colour, scroll/resize/reflow, the alternate screen, clear (ED 2 + ED 3), replies per pane and never in the cells, many replies from one read, kitty before DA, CAN/SUB, an oversized image, 300 images against the storage limit, animations and relative placements.
The harness runs test/kitty_client.zig in a pane's bash (query, a 16-chunk 8x4-cell place, the three media, quiet levels, CAN, show then delete) and kitten icat (stream and detect) and chafa when installed. Outside, the tty arm is a kitty terminal (a ghostty-vt emulator): the image pardes re-emits lands at the cell after ANCHOR>, 8x4 cells a row at a time, the client's own commands and replies never pass through, and d=I frees what was sent. The gui arm reads the GPU capture.
Fixed: kitty file, temporary-file and shared-memory media (libghostty defaults to direct only; now allWithTempDir like ghostty and kitty); replies past 256 bytes of one read were cut mid-sequence (4 KiB now, an answer that does not fit dropped whole and counted); animations never played (TerminalImages draws renderData(), ticks ImageStorage.animationTick on the core clock, nextWake wakes for the next frame); relative placements (P=/Q=/H=/V=) were not drawn (resolveChain, as ghostty's renderer). image.decode no longer jumps through stb_image's null allocator before image.start.
Known gap (a knownGap test): no z-index; every image is drawn over the cells in storage order.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -1316,6 +1316,40 @@ pub fn build(b: *std.Build) void { run_image_harness.has_side_effects = true; b.step("image-harness", "exercise native Kitty/SDL image rendering end to end").dependOn(&run_image_harness.step); + // Kitty graphics through a terminal pane, end to end: a client in + // the pane's bash (and kitten icat, chafa when installed), a kitty + // terminal outside (tty) or the GPU capture (gui). test/kitty.zig + // is the same protocol at the core. + const kitty_client = b.addExecutable(.{ + .name = "pardes-kitty-client", + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/kitty_client.zig"), + .link_libc = true, + }), + }); + const kitty_harness = b.addExecutable(.{ + .name = "pardes-kitty-harness", + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/kitty_harness.zig"), + .link_libc = true, + }), + }); + if (ghostty_vt_for_snap) |vt| kitty_harness.root_module.addImport("ghostty-vt", vt); + switch (target.result.os.tag) { + .freebsd, .netbsd, .openbsd => kitty_harness.root_module.linkSystemLibrary("util", .{}), + else => {}, + } + const run_kitty_harness = b.addRunArtifact(kitty_harness); + run_kitty_harness.addArtifactArg(exe); + run_kitty_harness.addArtifactArg(kitty_client); + run_kitty_harness.addArg(if (platform == .gui) "gui" else "tty"); + run_kitty_harness.has_side_effects = true; + b.step("kitty-harness", "kitty graphics through a terminal pane end to end (a client inside, a kitty terminal or the GPU capture outside)").dependOn(&run_kitty_harness.step); + const pdf_harness_step = b.step("pdf-harness", "exercise continuous PDF rendering, search, and sections navigation end to end"); if (enable_mupdf) { const run_pdf_harness = b.addRunArtifact(image_harness); @@ -1694,6 +1728,28 @@ pub fn build(b: *std.Build) void { pane_test_step.dependOn(&run_pane_tests.step); if (testMatch(b, unit_profile, test_filters, pane_test_step)) |check| check.addArtifactArg(pane_tests); + // Kitty graphics conformance at the core: what a terminal pane's + // program sends, what it reads back, what ghostty stores and what a + // frame draws (test/kitty.zig). The end-to-end arm, through a real + // pty and the shell's output, is the kitty-harness step. + const kitty_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/kitty.zig"), + .link_libc = true, + }); + kitty_module.addImport("pardes", core_module); + const kitty_tests = b.addTest(.{ .root_module = kitty_module, .filters = test_filters }); + if (test_nonce) |nonce| kitty_tests.root_module.addImport("test_rebuild_nonce", nonce); + test_build.dependOn(&kitty_tests.step); + const run_kitty_tests = b.addRunArtifact(kitty_tests); + run_kitty_tests.has_side_effects = true; + unit_step.dependOn(&run_kitty_tests.step); + if (unit_match) |check| check.addArtifactArg(kitty_tests); + const kitty_test_step = b.step("kitty-test", "run the kitty graphics conformance cases for terminal panes"); + kitty_test_step.dependOn(&run_kitty_tests.step); + if (testMatch(b, unit_profile, test_filters, kitty_test_step)) |check| check.addArtifactArg(kitty_tests); + // Keep native transport integration reachable even when the core's // anonymous test-import block is filtered out by Zig. const ninep_io_module = b.createModule(.{ |
