aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/search.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-core/src/search.rs b/helix-core/src/search.rs
index 55f7bf1d..7dd2f4fc 100644
--- a/helix-core/src/search.rs
+++ b/helix-core/src/search.rs
@@ -41,7 +41,8 @@ pub fn find_nth_prev(
inclusive: bool,
) -> Option<usize> {
// start searching right before pos
- let mut chars = text.chars_at(pos.saturating_sub(1));
+ pos = pos.saturating_sub(1);
+ let mut chars = text.chars_at(pos);
for _ in 0..n {
loop {
@@ -56,7 +57,7 @@ pub fn find_nth_prev(
}
if !inclusive {
- pos -= 1;
+ pos += 1;
}
Some(pos)