szn

Bug 416 — Copy-mode selection

416. Copy-mode selection: end anchor is screen rows while start is scroll-compensated — wheel scrolling slides the selection’s end off the content

Severity: MEDIUM Status: ✅ RESOLVED

const sy_i64 = @as(i64, @intCast(self.selection.start_y)) + diff_start;
const ey_i64 = @as(i64, @intCast(self.selection.end_y));   // NOT compensated

Selection start is mapped through the scroll delta (diff_start) into buffer coordinates; selection end stays in raw screen rows. Wheel scroll or moveUp/moveDown past the viewport changes scroll_offset without touching end_y, so the highlighted region — and the text yankSelection extracts — shifts out from under the anchor the user visually set.

Fix: store both anchors in the same coordinate space (buffer-absolute), converting at set-time and re-projecting for display.