aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA-Walrus2022-10-04 21:49:43 +0000
committerGitHub2022-10-04 21:49:43 +0000
commitc927d61791968eebe1e6988d92d212b1662c66c0 (patch)
treec6946575b84dc4cb43e4fead94d474f6024d8c56
parentccb38e76962cb4dad1ca293b7dca07c90d5e0768 (diff)
Fix bugs in search wraparound message (#4101)
-rw-r--r--helix-term/src/commands.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 2563880b..2db5bfcf 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,
@@ -1569,6 +1570,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 +1611,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 +1712,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
direction,
scrolloff,
wrap_around,
+ false,
);
},
);
@@ -1740,6 +1747,7 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
direction,
scrolloff,
wrap_around,
+ true,
);
}
} else {