summaryrefslogtreecommitdiff
path: root/src/Text.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 16:29:36 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit79cdf76fd2dd0ba03622bfe742b525b770d51684 (patch)
tree8f0d73a0dfdb3f39839d0b5be9dff9af0473638a /src/Text.zig
parent7ce5d94b5d48b68c86d015060ebcabe63e299e1a (diff)
downloadpardes-79cdf76fd2dd0ba03622bfe742b525b770d51684.tar.gz
pardes-79cdf76fd2dd0ba03622bfe742b525b770d51684.zip
K and Alt-K keep or drop the ranges a regex matches in; Alt-: turns every range forward
K and Alt-K share the s/S prompt, which now carries a mode rather than a split flag: a range stays when a match starts inside it (K) or when none does (Alt-K), the primary becomes the first, and keeping none leaves the selection as it was (helix keep_or_remove_matches). Alt-: is ensure_selections_forward. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Text.zig')
-rw-r--r--src/Text.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Text.zig b/src/Text.zig
index 56ee199b..411c2ec8 100644
--- a/src/Text.zig
+++ b/src/Text.zig
@@ -328,6 +328,15 @@ pub fn multiSelAction(t: *Text, text: []const u8, kind: modal.Normal.Multi, cnt:
}
return setRanges(t, text, out[0..m], &.{}, pri, expl);
}
+ if (kind == .ensure_forward) {
+ // helix ensure_selections_forward: every range points forward
+ for (rs[0..n]) |*r| {
+ const from = @min(r.anchor, r.head);
+ r.head = @max(r.anchor, r.head);
+ r.anchor = from;
+ }
+ return setRanges(t, text, rs[0..n], &.{}, got.pri, expl);
+ }
if (kind == .split_newline) {
// helix selection::split_on_newline — one range per line the
// selection covers, the newlines themselves left out