on master help sign in
fix: error that caused usize to overflow (#3024)

* fix: error that caused usize to overflow * update: changed check_sub to saturating_sub

commite109022bfd34b9297905b9da5904f6aa2279e74f authorSlug <106496265+GreasySlug@users.noreply.github.com> dateSun 10 Jul 2022, 17:54 (4 years ago) parent718c3ba
1 file changed+1−1
helix-term/src/commands.rs+1−1
helix-term/src/commands.rs+1−1
@@ -1414,7 +1414,7 @@ fn copy_selection_on_line(cx: &mut Context, direction: Direction) {
14141414 let (head, anchor) = if range.anchor < range.head {
14151415 (range.head - 1, range.anchor)
14161416 } else {
1417− (range.head, range.anchor - 1)
1417+ (range.head, range.anchor.saturating_sub(1))
14181418 };
14191419
14201420 let tab_width = doc.tab_width();