From 73471bb12337a75eb27e10d36d5c1a7b92e0a06a Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Tue, 4 Oct 2022 22:35:08 +0300 Subject: [PATCH 1/2] Fix bugs in search wraparound message Before it would display message in the statusbar about wrapping around while you where typing the regex. And it would display a message about wrapping around when there are no matches at all and you hit n/N --- helix-term/src/commands.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 2563880bfef1..b90306b78877 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1569,6 +1569,7 @@ fn search_impl( direction: Direction, scrolloff: usize, wrap_around: bool, + show_warnings: bool, ) { let (view, doc) = current!(editor); let text = doc.text().slice(..); @@ -1609,9 +1610,13 @@ fn search_impl( regex.find_iter(&contents[start..]).last() } }; - editor.set_status("Wrapped around document"); - } else { - editor.set_error("No more matches"); + } + if show_warnings { + if wrap_around && mat.is_some() { + editor.set_status("Wrapped around document"); + } else { + editor.set_error("No more matches"); + } } } @@ -1706,6 +1711,7 @@ fn searcher(cx: &mut Context, direction: Direction) { direction, scrolloff, wrap_around, + false, ); }, ); @@ -1740,6 +1746,7 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir direction, scrolloff, wrap_around, + true, ); } } else { From ee812ba7ed2f9f412ae72aa310d89abfb871bef7 Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Tue, 4 Oct 2022 23:14:32 +0300 Subject: [PATCH 2/2] Fix clippy lints --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index b90306b78877..2db5bfcf3019 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1561,6 +1561,7 @@ fn split_selection_on_newline(cx: &mut Context) { doc.set_selection(view.id, selection); } +#[allow(clippy::too_many_arguments)] fn search_impl( editor: &mut Editor, contents: &str,