Renderer rows silently corrupt Kitty APC graphics escapes — blocks inline images from mods
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- cli
Rechercherichtung
Beginne mit der angehängten kitty-graph-repro.ts und untersuche die Zeilenpipeline des Renderers, einschließlich ihres Breitenberechners und Zeilensanitisierers. Vergleiche direkte fd-Schreibvorgänge mit APCs, die als Zeilen zurückgegeben werden, und überprüfe anschließend in der angegebenen kitty-Umgebung, dass vollständige und in Abschnitte aufgeteilte APC-Sequenzen ein Repaint ohne Beschädigung oder Vermischung überstehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Mod renderer rows silently corrupt Kitty Graphics Protocol (APC) escape sequences, making inline images impossible from mods even though the docs promise row styling with raw codes (api.md: "style them with ansi escapes — picocolors, @commandcode/tui helpers, or raw codes"). SGR escapes survive; multi-line APC payloads do not. This bug blocks any cmd.ui.image()-style feature (see #633 §7) and any mod that talks to a terminal graphics protocol.
Repro (mod-side, minimal)
A mod registers a renderer whose first row is a complete kitty APC (\x1b_Gf=100,q=1,a=T,...;<base64>\x1b\\). The same bytes written directly to fd 1 draw the image; the same bytes returned as a renderer row never draw. Verified today on kitty 0.42 with a browser-rendered PNG (784×62), all in a live session:
| Delivery | Result |
|---|---|
writeSync(1, apc) from inside the renderer |
image draws |
| APC as first renderer row, 4096-byte payload | no image (row wraps at terminal width → sequence corrupted) |
APC split into 96-byte / 64-byte row chunks, chained with m=1/m=0 |
still no image |
Root cause (two layers)
- Wrap corruption: a KB-scale APC cannot fit one terminal line; the feed wraps long rows at the column width, splitting the sequence mid-payload. Kitty silently drops malformed graphics sequences when
q=1— no error reaches the mod or the user. - Chunk-chain interleaving: splitting into line-sized chunks per the protocol's own
m=continuation mechanism doesn't help either — the feed joins rows with\nand full-screen repaints can split the chain across writes, and interleaved bytes between continuation chunks invalidate the transmission (again silently).
The SGR-red-caption probe proved the pipe itself passes escapes — the chain specifically dies between chunks.
What would fix it
Either of:
- APC passthrough in the row pipeline — treat
\x1b_G…\x1b\\as an atomic zero-width unit in the width calculator and row sanitizer (the same allowance SGR already gets), so a chain of line-sized APCs rides the row stream intact. Mod-side we already chunk to 64-byte rows precisely for this. - A first-class image API — e.g.
cmd.ui.image({ path, rows })that owns protocol detection, chunking, placement, and repaint behavior (would supersede/fold into #633 §7cmd.ui.image(); this issue supplies the pipeline groundwork it needs).
Until then, mods must fall back to writing directly to fd 1, which draws the image but anchors it to whatever the cursor happens to be at render time — placement drifts relative to the feed block (phantom padding), and it breaks under scroll.
Environment
- Command Code 1.37.0 (npm global)
- kitty 0.42,
TERM=xterm-kitty, interactive TTY (graphics protocol verified working via raw fd write) - Repro mod:
kitty-graph-repro.ts(attached to this issue) — encoder, capability gate, and both delivery strategies; the Delivery A/B switch is a one-line change in the renderer
Related
- #633 §7 —
cmd.ui.image()feature request (the umbrella this bug blocks) - #609 — adjacent: feed rendering surface limitations for mods
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 4k
- Forks
- 350
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CommandCodeAI/command-code
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#855 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CommandCodeAI/command-code#841 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#655 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#608 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
CommandCodeAI/command-code#893 ·
Alle Issues in CommandCodeAI/command-code
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
hust-open-atom-club/hustmirror-cli#52 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
qgis/QGIS-Documentation#11275 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
milvus-io/birdwatcher#545 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
JuliusBrussee/caveman#1102 · 1 Kommentar ·