on master help sign in
Fix bugs in search wraparound message (#4101)
c927d61A-Walrus
helix-term/src/commands.rs+11−3
@@ -1561,6 +1561,7 @@ fn split_selection_on_newline(cx: &mut Context) {
1561 doc.set_selection(view.id, selection);
1561 doc.set_selection(view.id, selection);
1562}
1562}
1563
1563
1564+#[allow(clippy::too_many_arguments)]
1564fn search_impl(
1565fn search_impl(
1565 editor: &mut Editor,
1566 editor: &mut Editor,
1566 contents: &str,
1567 contents: &str,
@@ -1569,6 +1570,7 @@ fn search_impl(
1569 direction: Direction,
1570 direction: Direction,
1570 scrolloff: usize,
1571 scrolloff: usize,
1571 wrap_around: bool,
1572 wrap_around: bool,
1573+ show_warnings: bool,
1572) {
1574) {
1573 let (view, doc) = current!(editor);
1575 let (view, doc) = current!(editor);
1574 let text = doc.text().slice(..);
1576 let text = doc.text().slice(..);
@@ -1609,9 +1611,13 @@ fn search_impl(
1609 regex.find_iter(&contents[start..]).last()
1611 regex.find_iter(&contents[start..]).last()
1610 }
1612 }
1611 };
1613 };
1614+ }
1615+ if show_warnings {
1616+ if wrap_around && mat.is_some() {
1612− editor.set_status("Wrapped around document");
1617+ editor.set_status("Wrapped around document");
1613− } else {
1618+ } else {
1614− editor.set_error("No more matches");
1619+ editor.set_error("No more matches");
1620+ }
1615 }
1621 }
1616 }
1622 }
1617
1623
@@ -1706,6 +1712,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
1706 direction,
1712 direction,
1707 scrolloff,
1713 scrolloff,
1708 wrap_around,
1714 wrap_around,
1715+ false,
1709 );
1716 );
1710 },
1717 },
1711 );
1718 );
@@ -1740,6 +1747,7 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
1740 direction,
1747 direction,
1741 scrolloff,
1748 scrolloff,
1742 wrap_around,
1749 wrap_around,
1750+ true,
1743 );
1751 );
1744 }
1752 }
1745 } else {
1753 } else {