szn

Bug 200 — Redundant per-cell dx/dy storage in the 128-bit Cell

200. Redundant per-cell dx/dy storage in the 128-bit Cell

File: src/grid.zig:26–33 (Cell layout), src/screen.zig:124–141 (per-cell comb1/comb2 fill) Severity: LOW Status: ✅ FIXED — SixelImage now stores a single anchor_col/anchor_row (the image top-left) set in addSixelImage. renderSixelImages and the merged-screen clipping derive the draw position from this anchor instead of reconstructing it from each cell’s comb1/comb2, eliminating the consistency hazard when a cell is partially overwritten. Because the anchor must track content as the grid scrolls, Screen.shiftSixelAnchors() is called whenever the main grid scrolls up/down. Added unit test renderSixelImages derives position from image anchor not cell comb — bug #200.

The design stores comb1 (13-bit dx) and comb2 (13-bit dy) in every sixel cell, even though the anchor is fully reconstructable from any single cell (anchor = (x - dx, y - dy)). This consumes 26 bits per cell and is a consistency hazard: if any cell in an image is partially overwritten (e.g. by a text write that fails to clear attr.sixel), the reconstructed anchor becomes wrong for that cell’s region, producing a mis-placed redraw. The anchor (or the single top-left cell coordinate) could instead be stored once in the registry SixelImage and referenced by id.