insertChars / deleteChars refcount bookkeeping only covers the tail cellsinsertChars / deleteChars refcount bookkeeping only covers the tail cellsFile: src/screen.zig:1011–1027
Severity: MEDIUM
Status: ✅ FIXED — insertChars releases refcounts for the rightmost num cells shifted off the edge; deleteChars releases the leftmost num cells shifted off the edge (previously the wrong tail cells were decremented). Two regression tests.
insertChars decrements only the refcount of the cell at width-1, but the grid shift also erases the cleared region x..x+num-1 (sixel markers destroyed there are never decremented).deleteChars decrements refcounts for width-n .. width-1, but the actually-cleared region is width-num .. width-1 where num = min(n, width - cursor_x); when n > width - cursor_x, cells that are shifted and still visible get their refcounts decremented (same under-count class as #278/#279).