aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-term/src/commands.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index c285fd41..5960121a 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -639,6 +639,11 @@ fn _search(doc: &mut Document, view: &mut View, contents: &str, regex: &Regex, e
let start = text.byte_to_char(mat.start());
let end = text.byte_to_char(mat.end());
+ if end == 0 {
+ // skip empty matches that don't make sense
+ return;
+ }
+
let head = end - 1;
let selection = if extend {