aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorahkrr2021-06-05 14:25:45 +0000
committerBlaž Hrastnik2021-06-05 15:01:16 +0000
commit444cd0b068f5a838caeeb7aa9c2d570fa330ce97 (patch)
tree0ffe7d6870032f84bacfda344aba9ac7423b21e0 /helix-term/src/commands.rs
parentf6a900fee1397e26c37489a3d434a9a77fbcc30a (diff)
fix: make find_prev_char and till_prev_char work
Bevore this PR `commands::find_prev_char` and `commands::till_prev_char` were triggerable through keys but `seach::find_nth_next()` was hardcoded in `_find_char`. The passed `fn` was nerver used. With this PR the passed `fn` is used. The change in search.rs resolves an off by one error in the behivor of `find_nth_prev`
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 12ec5e19..bff102dc 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -315,7 +315,7 @@ fn _find_char<F>(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool)
where
// TODO: make an options struct for and abstract this Fn into a searcher type
// use the definition for w/b/e too
- F: Fn(RopeSlice, char, usize, usize, bool) -> Option<usize>,
+ F: Fn(RopeSlice, char, usize, usize, bool) -> Option<usize> + 'static,
{
// TODO: count is reset to 1 before next key so we move it into the closure here.
// Would be nice to carry over.
@@ -332,7 +332,7 @@ where
let text = doc.text().slice(..);
let selection = doc.selection(view.id).transform(|mut range| {
- search::find_nth_next(text, ch, range.head, count, inclusive).map_or(range, |pos| {
+ search_fn(text, ch, range.head, count, inclusive).map_or(range, |pos| {
if extend {
Range::new(range.anchor, pos)
} else {