szn

Bug 381 — g doesn’t go to the top of history

381. Half-implemented pair

File: src/mode_copy.zig:145-153 (cf. placeCursorAtLogical, :549) Severity: MEDIUM Status: ✅ FIXED

Fix (applied)

moveToTop now pins scroll_offset = historyLen() with cursor at 0,0 — the true top of the buffer — matching moveToBottom’s jump to offset 0. Both g (vi) and < (emacs) route through it. Signature takes the grid like its counterpart.

Test: g jumps to absolute top of history — bug #381 (scrollback built via scrollUp; mid-scrollback state lands at offset == historyLen, cursor 0,0).

Problem

pub fn moveToTop(self: *CopyMode) void { self.cursor_y = 0; self.cursor_x = 0; }   // keeps scroll_offset
pub fn moveToBottom(self: *CopyMode, grid: ...) { ...; self.scroll_offset = 0; }

G jumps to the live bottom; g leaves whatever scroll offset was active, so the viewport doesn’t move to history top at all.

Fix (proposed)

moveToTop should set scroll_offset = historyLen() and pin (matching the placeCursorAtLogical remap), mirroring G.