Skip to content

Track cell-aligned SIXEL and Kitty graphics placements and erases #14

Closed

Description

@tony

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 Policy or Terminal(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 by Limits (max_dcs_bytes, max_apc_bytes, and a bounded placement/image count).

Intent (non-binding)

  • Reassemble Kitty APC G multi-chunk payloads (m=1 followed by m=0), maintain bounded images and placements tables keyed by (image_id, placement_id), process a=d (d=i/I/a/A/c/p) deletions, and shift placements with DECSTBM scroll regions.
  • Parse SIXEL raster 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, and ED.
  • Expose immutable placement views on Snapshot so libtmux tests can assert active and erased image regions declaratively.

Not doing

  • Decoding PNG/RGBA pixel buffers or shipping a software rasterizer inside libvt.

References

Activity

  1. added
    enhancement
    on Nov 22, 2026
  2. tony commented on Nov 23, 2026

    @tony
    MemberAuthor

    Pre-0.1.0 coordinate and reflow refinements

    Follow-up review refines two ImagePlacement and GraphicsTracker contracts before 0.1.0 locks public types:

  3. tony commented on Nov 23, 2026

    @tony
    MemberAuthor

    Resolved in #2 (0c7ee41).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions