Fix crash if typing | (regex or) into the prompt.

Zero-width matches at the start of the file make no sense to us.
pull/11/head
Blaž Hrastnik 4 years ago
parent 6e03019a2c
commit 54de768915

@ -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 start = text.byte_to_char(mat.start());
let end = text.byte_to_char(mat.end()); 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 head = end - 1;
let selection = if extend { let selection = if extend {

Loading…
Cancel
Save