aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/surround.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-24 14:44:11 +0000
committerNathan Vegdahl2021-07-24 14:44:11 +0000
commitf96b8b769b3c7457935b5c02db870af97036f7b6 (patch)
treea730fd2e970d6349e0f11b450f1e58b2c79d010b /helix-core/src/surround.rs
parent20723495d3ee82047bc7584e9eca1424d1256f4c (diff)
Switch to a cleaner range-head moving abstraction.
Also fix a bunch of bugs related to it.
Diffstat (limited to 'helix-core/src/surround.rs')
-rw-r--r--helix-core/src/surround.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/helix-core/src/surround.rs b/helix-core/src/surround.rs
index af357c96..4d3ed5f5 100644
--- a/helix-core/src/surround.rs
+++ b/helix-core/src/surround.rs
@@ -49,19 +49,18 @@ pub fn find_nth_pairs_pos(
if Some(open) == text.get_char(pos) {
// Special case: cursor is directly on a matching char.
match pos {
- 0 => Some((pos, search::find_nth_next(text, close, pos + 1, n, true)?)),
- _ if (pos + 1) == text.len_chars() => Some((
- search::find_nth_prev(text, open, pos, n, true)?,
- text.len_chars(),
- )),
+ 0 => Some((pos, search::find_nth_next(text, close, pos + 1, n)? + 1)),
+ _ if (pos + 1) == text.len_chars() => {
+ Some((search::find_nth_prev(text, open, pos, n)?, text.len_chars()))
+ }
// We return no match because there's no way to know which
// side of the char we should be searching on.
_ => None,
}
} else {
Some((
- search::find_nth_prev(text, open, pos, n, true)?,
- search::find_nth_next(text, close, pos, n, true)?,
+ search::find_nth_prev(text, open, pos, n)?,
+ search::find_nth_next(text, close, pos, n)? + 1,
))
}
} else {