Skip to content

Commit

Permalink
respect count for selecting next/previous match (helix-editor#3056)
Browse files Browse the repository at this point in the history
  • Loading branch information
QiBaobin authored and thomasskk committed Sep 9, 2022
1 parent d068373 commit e6069ab
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,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);
Expand All @@ -1708,16 +1709,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);
Expand Down

0 comments on commit e6069ab

Please sign in to comment.