on master help sign in
respect count for selecting next/previous match (#3056)
4418924Bob
helix-term/src/commands.rs+13−10
@@ -1687,6 +1687,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
1687}
1687}
1688
1688
1689fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Direction) {
1689fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Direction) {
1690+ let count = cx.count();
1690 let config = cx.editor.config();
1691 let config = cx.editor.config();
1691 let scrolloff = config.scrolloff;
1692 let scrolloff = config.scrolloff;
1692 let (view, doc) = current!(cx.editor);
1693 let (view, doc) = current!(cx.editor);
@@ -1705,16 +1706,18 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
1705 .multi_line(true)
1706 .multi_line(true)
1706 .build()
1707 .build()
1707 {
1708 {
1709+ for _ in 0..count {
1708− search_impl(
1710+ search_impl(
1709− doc,
1711+ doc,
1710− view,
1712+ view,
1711− &contents,
1713+ &contents,
1712− &regex,
1714+ &regex,
1713− movement,
1715+ movement,
1714− direction,
1716+ direction,
1715− scrolloff,
1717+ scrolloff,
1716− wrap_around,
1718+ wrap_around,
1717− );
1719+ );
1720+ }
1718 } else {
1721 } else {
1719 let error = format!("Invalid regex: {}", query);
1722 let error = format!("Invalid regex: {}", query);
1720 cx.editor.set_error(error);
1723 cx.editor.set_error(error);