Draw image comparisons as real pixels in kitty and Ghostty #11
Loading…
Reference in a new issue
No description provided.
Delete branch "kitty-graphics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The half-block mosaic is gone where it matters: in kitty and Ghostty the side-by-side copies are now actual pixels through the kitty graphics protocol - a quiet (
q=2) PNG transmit per image, a virtual placement letterboxed into its cell grid, drawn with unicode placeholders so the pictures scroll and reflow with the text like anything else on screen. Everywhere else keeps the half-block characters. Neither path queries the terminal, so the keyboard-freeze of the old PR #1 stays impossible by construction.Detection without the probe that froze keyboards
TERM, or their window hints (KITTY_WINDOW_ID,GHOSTTY_RESOURCES_DIR); tmux and ordinary terminals fall back to half-blocks.Verified against Ghostty's own core
tests/kitty_ghostty.rsruns the real binary in a pseudo-terminal at kitty cell geometry, feeds every byte it writes into libghostty-vt - the terminal emulation core of Ghostty - and asserts what Ghostty would draw:The nix work this needed
libghostty-vt is built from the exact commit the bindings were generated from (
a887df42) - the C ABI only froze at 1.0, a month later, so an older binding must be matched, not assumed. Only the VT library is built (no GUI stack), via a zon2nix package cache, and linked through pkg-config. The.pcfixup in the derivation normalises itsLibs:line to the conventional-L/-lform.Two bugs the gate surfaced
CellDiffOption::ForcedWidth(1).image::resizesilently ignores wrong dimensions (it fits within the box), hiding arithmetic bugs; the downscale now callsresize_exact, honest about the exact size it names.Gate
Mutating this PR's whole diff against
main, as CI will: 105 tested, 101 caught, 4 unviable, 0 missed. Reaching zero took three rounds - the first found 35 gaps, including two equivalent mutants hiding dead arithmetic (aminchain that could never bind, and a position condition whose first cell always matched), which are now removed rather than excluded.Checked: 83/83 tests, clippy clean with
-D warnings, statix clean,nix buildof libghostty-vt green on the runner.