aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-24 01:03:40 +0000
committerNathan Vegdahl2021-07-24 01:03:40 +0000
commit20723495d3ee82047bc7584e9eca1424d1256f4c (patch)
tree06e8309e09e8292a6cf110bc88b18fd57f3e3885
parent8f43dc40398ff8372b1612241081926bac6d2055 (diff)
Fixed find_till_char and find_char commands.
They worked correctly when extending, but not for normal cursor movement.
-rw-r--r--helix-term/src/commands.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index ca977f80..93867ee1 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -652,8 +652,13 @@ where
let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform(|range| {
- search_fn(text, ch, range.head, count, inclusive)
- .map_or(range, |pos| range.put(text, pos, extend))
+ search_fn(text, ch, range.head, count, inclusive).map_or(range, |pos| {
+ if extend {
+ range.put(text, pos, true)
+ } else {
+ range.put(text, pos.saturating_sub(1), false)
+ }
+ })
});
doc.set_selection(view.id, selection);
})