Unnamed repository; edit this file 'description' to name the repository.
Fix crash if typing | (regex or) into the prompt.
Zero-width matches at the start of the file make no sense to us.
Blaž Hrastnik 2021-05-16
parent 6e03019 · commit 54de768
-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 {