summaryrefslogtreecommitdiff
path: root/src/Text.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-24 11:57:26 -0300
committerGabriel Schneider <[email protected]>2026-10-24 11:57:35 -0300
commit51903dd947f90381d1a908c488a019289a1c8413 (patch)
treeab5b2574642493c60476e6e9bcd7cc0e1c5e8d9e /src/Text.zig
parent18d89dcedaed1f8437799621675e88ca47d7cdc1 (diff)
downloadpardes-51903dd947f90381d1a908c488a019289a1c8413.tar.gz
pardes-51903dd947f90381d1a908c488a019289a1c8413.zip
Search converge 3/6: the query pane, line 1 the query and its first word the source, rows made live like Callstack's, the owner's places showing the set, a +Preview promoted in place, Enter freezes, Esc restores
Diffstat (limited to 'src/Text.zig')
-rw-r--r--src/Text.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text.zig b/src/Text.zig
index cef76b3b..88630f83 100644
--- a/src/Text.zig
+++ b/src/Text.zig
@@ -182,7 +182,10 @@ pub fn primaryRange(t: *Text, text: []const u8, row0: i32) modal.Selection {
const e = if (r1 + 1 >= modal.cursorLineCount(text)) text.len else modal.lineStartOffset(text, r1 + 1);
return .{ .anchor = s, .head = @max(e, modal.nextGrapheme(text, c)) };
}
- if (t.vsel.active) return cellRange(text, t.vsel.row - row0, t.vsel.col, t.cur_row - row0, t.cur_col);
+ // Both ends through the line index, as the cursor's: cellRange counts
+ // lines from the top for each, a pass over a big file per call (the
+ // places' settle and every insert-mode key asked it).
+ if (t.vsel.active) return cellOffRange(text, File.textOffset(t, text, .{ .row = @intCast(@max(0, t.vsel.row - row0)), .col = @intCast(@max(0, t.vsel.col)) }), c);
return .{ .anchor = c, .head = modal.nextGrapheme(text, c) };
}