Repository navigation
Support kitty unicode placeholders (U=1) in addon-image - #6198
valenvivaldi wants to merge 1 commit into
Conversation
Virtual placements are stored without being written to cells and are drawn wherever the client writes U+10EEEE placeholder cells: row/column diacritics select the tile, the fg color (24-bit or 256, plus the optional third diacritic) carries the image id and the underline color the placement id. Missing diacritics are inferred from the left cell. Placeholder cells are marked invisible after each parsed write so the text renderer draws neither the glyph nor its diacritics. Retransmitting an image with a=T,U=1 swaps the placement in place, so animations do not flicker. Fixes xtermjs#5711
|
Heads-up: I saw #6145, #6132 and the feedback on #6098 about where kitty logic should live. This PR predates that redesign and puts the placeholder rendering in |
|
Independent confirmation: I built the same feature separately (master...petersindex:xterm.js:feat/kitty-unicode-placeholders) and tested it end to end with Claude Code 2.1.290, whose plugin |
Support kitty Unicode placeholders (U=1) in addon-image
Fixes #5711
Kitty's Unicode placeholders let a client create a virtual placement (
a=T,U=1/a=p,U=1), then show it by writingU+10EEEEcells. Because the image lives in ordinary text cells, it scrolls, reflows and gets erased together with the text. TUI apps rely on this to draw images inside their layout, and right now they fall back to text in xterm.js-based terminals.What changes
Ukey.U=1decodes, crops and scales the image as before. It then stores the image as a virtual image inImageStorage. Nothing is written to cells and the cursor does not move.ImageStorage.renderlooks for placeholder cells and draws the tile each one references.rowcolumn-diacritics.txt.onWriteParsed), placeholder cells on the active screen are markedINVISIBLE. The text renderer then draws neither the placeholder glyph nor its diacritics. The cell shows its background, with the tile drawn on top.a=T,U=1and the same id swaps the virtual placement in place. The old entry is removed only after the new one is stored, so the image doesn't flicker or leak storage. Deletes (d=i/I,d=a/A), eviction andresetalso clean up virtual placements.Limitations
ExtendedAttrs.isEmptyignores it). Placement ids in the underline color therefore work only together with SGR 4. Without one, the cells use the most recent placement of the image. Clients that use a single placement per image, which is the common case, are unaffected. Fixing this would mean changing core, so I left it out of this PR.c×rcells, the same as the existing direct placements. It is not aspect-fit and centred the way kitty does it.Tests
KittyPlaceholder.test.tscovers diacritic decoding, including diacritics outside the BMP, 256-color ids, the MSB diacritic, underline placement ids, and inference from the left neighbour. Another test covers parsing of theUkey.Unicode placeholders (U=1)group inKittyGraphics.test.ts, with pixel checks on the image layer. It checks that: