diff options
| author | user <user@clank> | 2026-08-15 19:14:59 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-15 19:14:59 +0200 |
| commit | 2f0b3426d0f40d2cf53740cb597495af2c45bc2e (patch) | |
| tree | 1969c511f2ec69e234e4eb8b2ba1aa2bf78c7904 /README.md | |
| parent | sl0ppty: measure chrome in columns, not characters (diff) | |
| download | slosh-2f0b3426d0f40d2cf53740cb597495af2c45bc2e.tar.gz slosh-2f0b3426d0f40d2cf53740cb597495af2c45bc2e.tar.xz slosh-2f0b3426d0f40d2cf53740cb597495af2c45bc2e.zip | |
sl0ppty: decode the PNGs programs actually send
Kitty graphics were green in the suite and a real program still drew
nothing. libghostty-vt ships no image codec: built as a library it sets
its `sys.decode_png` hook to null, and a null hook rejects every `f=100`
transmission outright -- no image stored, so no placement exists, so the
re-emission layer this project is mostly *about* is never reached. The
program gets no error and no picture.
Raw RGB worked throughout, which is why it looked done: every test here
sent raw pixels, because that is what is easy to write in a test. It is
the same lesson the last kitty graphics bug taught -- write the test the
way a program actually behaves -- and a program with a picture on disk
has a PNG. Found because ida-tui's startup logo never appeared, and its
detection probe answers `OK` first, so it fails silently rather than
falling back to its block art.
PNG is the whole of the gap and cannot grow: the protocol has exactly
three formats (`f=24`, `f=32`, `f=100`), the first two are raw pixels
lib-vt already handles, and `decode_png` is the only codec hook it has.
Decoding only, never encoding.
The decoder is the stb_image lib-vt already vendors and we already
commit -- upstream compiles that same header with the same
`STBI_ONLY_PNG` for this same purpose, it is just not in the
`-Demit-lib-vt` build. So nothing new is pulled in; a file we already
ship is finally compiled. src/png.c is the hook, a header pre-check and
a copy: dimensions are read before decoding because the buffer we return
is allocated through lib-vt's limited allocator but stb's own working
allocation is plain malloc and answers to nothing.
Tests cover a PNG placed at the size it asked for (RGB and RGBA sources,
both normalised to RGBA), the client being handed `f=32` rather than the
png it was given, and a malformed png placing nothing without taking the
pane with it. They fail on the previous binary.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -121,8 +121,10 @@ mistyped command in a fresh session no longer closes the session. thing other multiplexers drop — including the useful half of the protocol, where a program uploads an image once and then places it every frame. Your terminal's cell size is carried through to each pane, so programs can size - images and place them without saying how many cells to cover. (Sixel is not - supported: the terminal core has no sixel decoder.) + images and place them without saying how many cells to cover. PNG uploads + are decoded here and handed to your terminal as pixels, because the terminal + core ships no image decoder of its own. (Sixel is not supported: there is no + sixel decoder either, and unlike PNG nobody has asked.) - **Small terminals degrade gracefully.** When panes no longer fit, the tab becomes a list of one-line headers with the focused pane open below them — and returns to exactly the layout you had when there is room again. |
