aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorSlug2022-07-10 08:54:06 +0000
committerGitHub2022-07-10 08:54:06 +0000
commite109022bfd34b9297905b9da5904f6aa2279e74f (patch)
treea067717a5f3a000a8af8db78c0126acd9883a364 /helix-term
parent718c3baebecf4a970bc32724c564fa506ed40065 (diff)
fix: error that caused usize to overflow (#3024)
* fix: error that caused usize to overflow * update: changed check_sub to saturating_sub
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs2
1 files changed, 1 insertions, 1 deletions
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();