From e109022bfd34b9297905b9da5904f6aa2279e74f Mon Sep 17 00:00:00 2001 From: Slug <106496265+GreasySlug@users.noreply.github.com> Date: Sun, 10 Jul 2022 17:54:06 +0900 Subject: [PATCH] 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(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c9e350628..193d5d405 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();