diff options
author | Nathan Vegdahl | 2021-07-24 14:44:11 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-24 14:44:11 +0000 |
commit | f96b8b769b3c7457935b5c02db870af97036f7b6 (patch) | |
tree | a730fd2e970d6349e0f11b450f1e58b2c79d010b /helix-core/src/search.rs | |
parent | 20723495d3ee82047bc7584e9eca1424d1256f4c (diff) |
Switch to a cleaner range-head moving abstraction.
Also fix a bunch of bugs related to it.
Diffstat (limited to 'helix-core/src/search.rs')
-rw-r--r-- | helix-core/src/search.rs | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/helix-core/src/search.rs b/helix-core/src/search.rs index d4eb11a9..243ac227 100644 --- a/helix-core/src/search.rs +++ b/helix-core/src/search.rs @@ -1,12 +1,6 @@ use crate::RopeSlice; -pub fn find_nth_next( - text: RopeSlice, - ch: char, - mut pos: usize, - n: usize, - inclusive: bool, -) -> Option<usize> { +pub fn find_nth_next(text: RopeSlice, ch: char, mut pos: usize, n: usize) -> Option<usize> { if pos >= text.len_chars() || n == 0 { return None; } @@ -25,20 +19,10 @@ pub fn find_nth_next( } } - if !inclusive { - pos -= 1; - } - - Some(pos) + Some(pos - 1) } -pub fn find_nth_prev( - text: RopeSlice, - ch: char, - mut pos: usize, - n: usize, - inclusive: bool, -) -> Option<usize> { +pub fn find_nth_prev(text: RopeSlice, ch: char, mut pos: usize, n: usize) -> Option<usize> { if pos == 0 || n == 0 { return None; } @@ -57,9 +41,5 @@ pub fn find_nth_prev( } } - if !inclusive { - pos += 1; - } - Some(pos) } |