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 /src/pardes.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 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 3721cc32..c7ae6704 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -7813,6 +7813,16 @@ pub const Pardes = struct { const wait = @max(1, (pane.repl_enter_due_ns -| p.stepped_ns + animation.frame_ns - 1) / animation.frame_ns); frames = if (frames) |soonest| @min(soonest, wait) else wait; }; + // A terminal's kitty animation, at its next frame. Only a time still + // ahead counts: a pane not drawn keeps the last one it was given, + // and a past one would wake every frame for nothing. + if (comptime terminal_panes) for (p.panes) |slot| if (slot) |pane| if (panes.terminal.animationDueMs(pane)) |due_ms| { + const due = due_ms *| std.time.ns_per_ms; + if (due > p.stepped_ns) { + const wait = @max(1, (due - p.stepped_ns + animation.frame_ns - 1) / animation.frame_ns); + frames = if (frames) |soonest| @min(soonest, wait) else wait; + } + }; return if (frames) |n| p.stepped_ns + n * animation.frame_ns else null; } |
