summaryrefslogtreecommitdiff
path: root/src/Text.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:48:34 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:16:28 -0300
commit6cddaba55b83e6c164cdd04eb7972590bf195e34 (patch)
tree0853540d586322530af916014ddad8c91b72e2ce /src/Text.zig
parentec25911885652c793f8694e6abd035bdc67d1aa6 (diff)
downloadpardes-6cddaba55b83e6c164cdd04eb7972590bf195e34.tar.gz
pardes-6cddaba55b83e6c164cdd04eb7972590bf195e34.zip
edit, Text: the four one-edit multi-range ops (J, Alt-(, &, Ctrl-c) widen their rows with allSelRows and end with setEditCells, which puts the text in and selects the ranges' cells, instead of four copies of both
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
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 202cc339..7801d364 100644
--- a/src/Text.zig
+++ b/src/Text.zig
@@ -205,7 +205,10 @@ pub fn cellOffRange(text: []const u8, a: usize, c: usize) modal.Selection {
return .{ .anchor = modal.nextGrapheme(text, a), .head = c };
}
-pub fn rangeCells(text: []const u8, r: modal.Selection) struct { cur: usize, anc: usize } {
+/// A range's cursor and anchor cells, as offsets.
+pub const Cells = struct { cur: usize, anc: usize };
+
+pub fn rangeCells(text: []const u8, r: modal.Selection) Cells {
if (r.head > r.anchor) return .{ .cur = modal.prevGrapheme(text, r.head), .anc = r.anchor };
if (r.head < r.anchor) return .{ .cur = r.head, .anc = modal.prevGrapheme(text, r.anchor) };
return .{ .cur = r.head, .anc = r.head };