Support the kitty image protocol natively through rio-vt - #142
Support the kitty image protocol natively through rio-vt#142raphamorim wants to merge 10 commits into
Conversation
|
Ran a double review over this branch (a general correctness pass with adversarial verification, plus an independent kitty-conformance/integration pass) and pushed fixes for everything that survived:
Three engine-side issues surfaced that belong in rio-vt rather than here, filing separately: Now 116 tests, including per-run slicing, indexed-color placeholders, alt-screen id collisions, clipped scrolling, z ordering, and refresh gating. |
|
The three engine-side issues from the review are fixed upstream and released in rio-vt 0.5.20 (raphamorim/rio@390a66f477, 531b897293, e6772529be), so this PR now depends on it:
No ratty code changes were needed for the bump — 117 tests pass against 0.5.20. |
Now that the vt100 engine is gone (#140), we can lean on rio-vt for the kitty graphics protocol too. This deletes ratty's hand-rolled APC parser and enables rio-vt's
graphicsfeature instead, so the whole protocol — chunked transmissions, PNG/RGB/RGBA payloads, placement ids, deletes, queries, quiet modes, the 320MB eviction budget, and per-screen state on alt-screen swaps — is handled by the engine, which already answers acks and queries through the same reply path we use for DA/DSR.On ratty's side, kitty state is now derived from the engine each frame: decoded pixels arrive through
RioEvent::UpdateGraphicsand become Bevy textures, and placements are resolved from the engine's absolute, scrollback-aware positions. That fixes a few things the old parser couldn't do:x=/y=/w=/h=) and sub-cell offsets (X=/Y=) are honored, both for sprites and for the warped 3D planeskitten icat --unicode-placeholderstyle virtual placements are matched against the engine's placement registry rather than guessed from cell colors aloneThe PTY grid resize now passes pixel dimensions through to the engine, since placements are sized against the cell pixel metrics. Sixel stays unadvertised in DA1: the engine can decode it now, but ratty only renders kitty placements.
Tests cover direct and chunked transfers, RGB expansion, crops, scrollback tracking, deletes dropping their textures, placeholder-driven placements, and queries being acked without placing anything.