aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob2022-07-13 15:01:42 +0000
committerGitHub2022-07-13 15:01:42 +0000
commit4418924ec34c28e43ce34809edaac4ce4fd9f72c (patch)
tree7f6eca154ef83463d0ee4d07f8ce6ba4fe426fec
parente6a6e251c5cb2c373584187c3d4d17b3eaac6b6a (diff)
respect count for selecting next/previous match (#3056)
-rw-r--r--helix-term/src/commands.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index cb223faf..dad3db86 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -1687,6 +1687,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
}
fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Direction) {
+ let count = cx.count();
let config = cx.editor.config();
let scrolloff = config.scrolloff;
let (view, doc) = current!(cx.editor);
@@ -1705,16 +1706,18 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
.multi_line(true)
.build()
{
- search_impl(
- doc,
- view,
- &contents,
- &regex,
- movement,
- direction,
- scrolloff,
- wrap_around,
- );
+ for _ in 0..count {
+ search_impl(
+ doc,
+ view,
+ &contents,
+ &regex,
+ movement,
+ direction,
+ scrolloff,
+ wrap_around,
+ );
+ }
} else {
let error = format!("Invalid regex: {}", query);
cx.editor.set_error(error);