aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 2e205fa6..0cbc3f9d 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -612,8 +612,11 @@ fn _search(doc: &mut Document, view_id: ViewId, contents: &str, regex: &Regex) {
let text = doc.text();
let start = doc.selection(view_id).cursor();
- // TODO: use find_at to find the next match after the cursor, loop around the end
- if let Some(mat) = regex.find_at(contents, start) {
+ // use find_at to find the next match after the cursor, loop around the end
+ let mat = regex
+ .find_at(contents, start)
+ .or_else(|| regex.find(contents));
+ if let Some(mat) = mat {
let start = text.byte_to_char(mat.start());
let end = text.byte_to_char(mat.end());
let selection = Selection::single(start, end - 1);