diff options
author | Blaž Hrastnik | 2021-05-16 09:58:43 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-05-16 09:58:43 +0000 |
commit | 54de768915d6c4cde339261712a3188be20a62ff (patch) | |
tree | 9127d0344bcf53d2ccb3d0331222e5154daf0215 /helix-term/src/commands.rs | |
parent | 6e03019a2c7ec6e9d00a6308fe716468f767dd58 (diff) |
Fix crash if typing | (regex or) into the prompt.
Zero-width matches at the start of the file make no sense to us.
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r-- | helix-term/src/commands.rs | 5 |
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 { |