Repository navigation
Description
Summary
Parser and Terminal in #2 emit raw SixelGraphic (DCS ... q) and KittyGraphic (APC G ... ST) events carrying cursor coordinates and payload bytes without reassembling multi-chunk Kitty uploads (m=1 / m=0) or tracking cell-aligned image placements across character overwrites, ICH/DCH, ECH/EL/ED, and DECSTBM scrolling.
Motivation
libtmux#886 lists verifying SIXEL and Kitty image erases on attached tmux client streams alongside status bars, borders, and display-popup overlays. Reconstructing image survival externally from SixelGraphic, KittyGraphic, and ScreenErased events alone is lossy because ordinary printable character writes and ICH/DCH horizontal cell shifts overwrite or move image cells in tmux without emitting ScreenErased.
Proposal
Invariants
The invariants below are load-bearing; everything under Intent is open.
- Graphics placement tracking is opt-in (for example via
PolicyorTerminal(track_graphics=True)), adding zero memory or hot-path cost when disabled and zero external image-decoding dependencies (dependencies = []). - Unterminated or oversized
SIXEL(DCS) and Kitty (APC) streams remain strictly bounded byLimits(max_dcs_bytes,max_apc_bytes, and a bounded placement/image count).
Intent (non-binding)
- Reassemble Kitty
APC Gmulti-chunk payloads (m=1followed bym=0), maintain boundedimagesandplacementstables keyed by(image_id, placement_id), processa=d(d=i/I/a/A/c/p) deletions, and shift placements withDECSTBMscroll regions. - Parse
SIXELraster headers ("Pan;Pad;Ph;Pv) and newline/repeat operators (-,!Pn) enough to compute cell-grid bounding footprints(row, col, rows, cols)under configurable(cell_px_w, cell_px_h)dimensions, invalidating or cropping covered placement cells on printable overwrites,ICH/DCH,ECH,EL, andED. - Expose immutable placement views on
Snapshotsolibtmuxtests can assert active and erased image regions declaratively.
Not doing
- Decoding PNG/RGBA pixel buffers or shipping a software rasterizer inside
libvt.
References
- Core(feat[vt]): Add sans-I/O VT engine, RLE grid, OSC 7501, input, and ADRs #2
- libtmux#886
tmuxregress/image_terminal.pyandregress/image_kitty.py(b2a0128): https://github.com/tmux/tmux/blob/b2a0128/regress/image_terminal.py and https://github.com/tmux/tmux/blob/b2a0128/regress/image_kitty.py- Kitty graphics protocol specification
Activity
graphics(feat[vt]): Add SIXEL and Kitty tracker (#14)
tony commentedon Nov 23, 2026
Pre-
0.1.0coordinate and reflow refinementsFollow-up review refines two
ImagePlacementandGraphicsTrackercontracts before0.1.0locks public types:ImagePlacement.row(andPromptZone.row) is replaced by monotonicabs_row: intresolved throughSnapshot.at_abs(abs_row)andSnapshot.viewport_row(abs_row)in Replace signedrowonPromptZoneandImagePlacementwithSnapshot.at_abs()#19.DECSTBMstraddling-SIXELnegative bit-shiftValueError, retaining_gfxacrossScreen.resize(), and remapping cell-anchored Kitty placements during primary reflow are tracked in FixDECSTBMSIXELshift crash and preserve graphics and unwrapped rows onresize()#21.tony commentedon Nov 23, 2026
Resolved in #2 (
0c7ee41).