szn

Bug 435 — Screen.resize leaves sixel anchor_row stale for images below the new height

435. Screen.resize leaves sixel anchor_row stale for images below the new height

Severity: MEDIUM Status: Fixed

Screen.resize re-clamps cursor, scroll region and saved cursor after a size change, but never touches the sixel anchor_row array:

// src/screen.zig:539-575
pub fn resize(self: *Screen, width: u32, height: u32) Error!void {
    // ... grid.setSizeCursor(...) ...
    if (self.scroll_region) |r| {
        const top = @min(r[0], height -| 1);
        const bottom = @min(r[1], height -| 1);
        if (top >= bottom) self.scroll_region = null else self.scroll_region = .{ top, bottom };
    }
    if (self.saved_cursor) |*sc| { sc.x = @min(sc.x, width -| 1); sc.y = @min(sc.y, height -| 1); }
    // NOTE: no clamp / shift of sixel anchor_row anywhere here
}

shiftSixelAnchors exists and is called on scroll, but resize does not call it.

Problem & Impact

Proposed Fix

After resizing, clamp sixel anchor_row to the new height (clearing or repositioning images that fall outside), or call shiftSixelAnchors as needed to keep anchors within [0, height). Decide deliberately whether to keep or drop off-screen sixel on resize (tmux clears them) and apply it consistently.