on master help sign in
Fix crash if typing | (regex or) into the prompt.

Zero-width matches at the start of the file make no sense to us.

commit54de768915d6c4cde339261712a3188be20a62ff authorBlaž Hrastnik <blaz@mxxn.io> dateSun 16 May 2021, 18:58 (5 years ago) parent6e03019
1 file changed+5
helix-term/src/commands.rs+5
helix-term/src/commands.rs+5
@@ -639,6 +639,11 @@ fn _search(doc: &mut Document, view: &mut View, contents: &str, regex: &Regex, e
639639 let start = text.byte_to_char(mat.start());
640640 let end = text.byte_to_char(mat.end());
641641
642+ if end == 0 {
643+ // skip empty matches that don't make sense
644+ return;
645+ }
646+
642647 let head = end - 1;
643648
644649 let selection = if extend {