on master help sign in
respect count for selecting next/previous match (#3056)
commit4418924ec34c28e43ce34809edaac4ce4fd9f72c authorBob <QiBaobin@users.noreply.github.com> dateWed 13 Jul 2022, 23:01 (4 years ago) parente6a6e25
1 file changed+13−10
helix-term/src/commands.rs+13−10
helix-term/src/commands.rs+13−10
@@ -1687,6 +1687,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
16871687}
16881688
16891689fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Direction) {
1690+ let count = cx.count();
16901691 let config = cx.editor.config();
16911692 let scrolloff = config.scrolloff;
16921693 let (view, doc) = current!(cx.editor);
@@ -1705,16 +1706,18 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
17051706 .multi_line(true)
17061707 .build()
17071708 {
1708− search_impl(
1709− doc,
1710− view,
1711− &contents,
1712− &regex,
1713− movement,
1714− direction,
1715− scrolloff,
1716− wrap_around,
1717− );
1709+ for _ in 0..count {
1710+ search_impl(
1711+ doc,
1712+ view,
1713+ &contents,
1714+ &regex,
1715+ movement,
1716+ direction,
1717+ scrolloff,
1718+ wrap_around,
1719+ );
1720+ }
17181721 } else {
17191722 let error = format!("Invalid regex: {}", query);
17201723 cx.editor.set_error(error);