szn

Bug 195 — Sixel overlay is never actually erased — ECH is ineffective, causing ghosting/smearing on scroll

195. Sixel overlay is never actually erased — ECH is ineffective, causing ghosting/smearing on scroll

File: src/server/render.zig:455–457 (per-cell erase), src/server/render.zig:389–396 (force_clear), src/server/render.zig:701–710 (slot-null / id-mismatch clear) Severity: HIGH Status: ✅ FIXED — Screen now carries sixel_last_anchor[64] (the clamped top-left cell each slot’s image was last drawn at). renderSixelImages erases any slot whose anchor moved or that disappeared by emitting a DECSIXEL erase-below (ESC P 1 q ESC \) at the previous anchor before redrawing, so the overlay is cleared instead of smeared/ghosted. ECH is no longer relied upon to clear sixel pixels. Unit tests renderSixelImages erases previous position when image scrolls and renderSixelImages erases removed image overlay verify the erase is emitted at the old anchor and the image is redrawn at the new one.

The sixel pixel data is emitted verbatim as a raw DCS sequence onto the terminal’s separate sixel overlay layer. The only mechanisms that attempt to remove old sixel are:

  1. try self.writeBytes("\x1b[X") (Erase Character) when a cell transitions sixel → non-sixel.
  2. The full-screen \x1b[2J issued by force_clear (only on eraseDisplay/resetHard/clearScreen).
  3. Clearing attr.sixel locally on the merged-screen cell copy when the slot is null / id mismatches / image doesn’t fit.

None of these reliably wipe the overlay:

This directly contradicts the design doc’s claimed “Perfect Scroll Sync” (sixel_grid_allocation.md:60). A real erase path is required — e.g. re-issue the image with an inline erase (DECSIXEL P2 erase operation) or, failing that, a targeted full repaint of the affected pane region rather than relying on ECH.