szn

Bug 251 — Out-of-bounds cursor_x in soft-wrapped copy mode search

File: src/mode_copy.zig:397–455, src/mode_copy.zig:464–539, src/mode_copy.zig:543–556 Severity: HIGH Status: ✅ FIXED — updated placeCursorAtLogical to map column offsets greater than grid width to physical line offsets (x / width) and physical column (x % width). Added test coverage.

Bug #234 updated lineBytes to concatenate contiguous soft-wrapped physical lines into a single logical line buffer. When a search match occurs on a wrapped continuation line, searchLogicalLine returns a cell column index found_x >= grid.width. placeCursorAtLogical assigns self.cursor_x = @intCast(x) directly, setting cursor_x past the physical width of the terminal grid (cursor_x >= grid.width). Additionally, searchForward loops over physical line indices (li += 1), causing soft-wrapped lines to be redundantly re-searched on subsequent iterations.

Fix: In placeCursorAtLogical, map logical and x to their exact physical line offset (logical + x / grid.width) and physical column (x % grid.width). Skip wrapped continuation lines in searchForward/searchBackward.