From e109022bfd34b9297905b9da5904f6aa2279e74f Mon Sep 17 00:00:00 2001 From: Slug Date: Sun, 10 Jul 2022 17:54:06 +0900 Subject: fix: error that caused usize to overflow (#3024) * fix: error that caused usize to overflow * update: changed check_sub to saturating_sub--- helix-term/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c9e35062..193d5d40 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1414,7 +1414,7 @@ fn copy_selection_on_line(cx: &mut Context, direction: Direction) { let (head, anchor) = if range.anchor < range.head { (range.head - 1, range.anchor) } else { - (range.head, range.anchor - 1) + (range.head, range.anchor.saturating_sub(1)) }; let tab_width = doc.tab_width(); -- cgit v1.2.3-70-g09d2