From 6cddaba55b83e6c164cdd04eb7972590bf195e34 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:48:34 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Text.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text.zig') 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 }; -- cgit v1.3