diff options
author | Blaž Hrastnik | 2021-06-23 03:27:38 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-23 03:27:38 +0000 |
commit | 9c53461429a3e72e3b1fb87d7ca490e168d7dee2 (patch) | |
tree | a8836367ceca64735f8e54fd9dc0abfd3f075ee1 /helix-core/src | |
parent | 7511110d82fe10d4560acf3675046c7ebfd821ae (diff) |
fix: Select matching at the start of the doc could crash. Fixes #346
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/selection.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index e452c2e2..de4879d6 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -352,7 +352,7 @@ pub fn select_on_matches( let start = text.byte_to_char(start_byte + mat.start()); let end = text.byte_to_char(start_byte + mat.end()); - result.push(Range::new(start, end - 1)); + result.push(Range::new(start, end.saturating_sub(1))); } } |