on master help sign in
fix: Select matching at the start of the doc could crash. Fixes #346
commit9c53461429a3e72e3b1fb87d7ca490e168d7dee2 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 23 Jun 2021, 12:27 (5 years ago) parent7511110
1 file changed+1−1
helix-core/src/selection.rs+1−1
helix-core/src/selection.rs+1−1
@@ -352,7 +352,7 @@ pub fn select_on_matches(
352352
353353 let start = text.byte_to_char(start_byte + mat.start());
354354 let end = text.byte_to_char(start_byte + mat.end());
355− result.push(Range::new(start, end - 1));
355+ result.push(Range::new(start, end.saturating_sub(1)));
356356 }
357357 }
358358