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))); } }