a73x

d7e61651

Force full row rebuild when selection span changes

a73x   2026-04-09 19:24

Commit message
Force full row rebuild when selection span changes

planRowRefresh only considered VT dirty flags, so pointer-driven
selection changes (motion, click) never triggered row rebuilds and
the highlight was never painted.

Track the selection span before draining the pointer queue and force
.full rebuild mode when it changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

src/main.zig
Old New
@@ -248,9 +248,11 @@ fn runTerminal(alloc: std.mem.Allocator) !void {
248 // Pointer events → update selection state 248 // Pointer events → update selection state
249 const ptr_cell_w = cell_w / @as(u32, @intCast(geom.buffer_scale)); 249 const ptr_cell_w = cell_w / @as(u32, @intCast(geom.buffer_scale));
250 const ptr_cell_h = cell_h / @as(u32, @intCast(geom.buffer_scale)); 250 const ptr_cell_h = cell_h / @as(u32, @intCast(geom.buffer_scale));
251 const prev_selection = activeSelectionSpan(selection);
251 for (pointer.event_queue.items) |ev| { 252 for (pointer.event_queue.items) |ev| {
252 handlePointerSelectionEvent(&selection, ev, ptr_cell_w, ptr_cell_h, cols, rows); 253 handlePointerSelectionEvent(&selection, ev, ptr_cell_w, ptr_cell_h, cols, rows);
253 } 254 }
255 const selection_changed = !std.meta.eql(activeSelectionSpan(selection), prev_selection);
254 if (pointer.event_queue.items.len > 0) { 256 if (pointer.event_queue.items.len > 0) {
255 pointer.event_queue.clearRetainingCapacity(); 257 pointer.event_queue.clearRetainingCapacity();
256 render_pending = true; 258 render_pending = true;
@@ -364,7 +366,7 @@ fn runTerminal(alloc: std.mem.Allocator) !void {
364 try render_cache.resizeRows(alloc, term_rows.len); 366 try render_cache.resizeRows(alloc, term_rows.len);
365 367
366 const refresh_plan = planRowRefresh( 368 const refresh_plan = planRowRefresh(
367 if (term.render_state.dirty == .full) .full else .partial, 369 if (term.render_state.dirty == .full or selection_changed) .full else .partial,
368 dirty_rows, 370 dirty_rows,
369 .{ 371 .{
370 .cursor = .{ 372 .cursor = .{