szn

Bug 219 — shiftSixelAnchors shifts images belonging to the wrong screen — alt/main anchor drift

219. shiftSixelAnchors shifts images belonging to the wrong screen — alt/main anchor drift

File: src/screen.zig:300–305 Severity: CRITICAL Status: ✅ FIXED — added alt_screen tag to SixelImage; shiftSixelAnchors only shifts images matching the active screen.

fn shiftSixelAnchors(self: *Screen, delta_rows: i32) void {
    for (&self.sixel_images) |*opt_img| {
        if (opt_img.*) |*img| {
            img.anchor_row += delta_rows;
        }
    }
}

The sixel image registry is shared between the main grid and the alt grid (there is only one sixel_images array per Screen). When the main grid scrolls (via writeChar, scrollUp, scrollDown, etc.), shiftSixelAnchors is called to keep image anchors in sync. But it shifts every registered image, including images that were placed on the alt screen. If the user switches to the alt screen (e.g. vim starts), the main grid’s scrolling should not affect alt-screen images, and vice versa. Currently, alt-screen sixel anchors drift every time the main grid scrolls.

Fix: Either maintain separate sixel registries per grid (main/alt), or tag each image with the grid it belongs to and filter shiftSixelAnchors accordingly.