Skip to content

Commit

Permalink
fix: error that caused usize to overflow (#3024)
Browse files Browse the repository at this point in the history
* fix: error that caused usize to overflow

* update: changed check_sub to saturating_sub
  • Loading branch information
GreasySlug authored Jul 10, 2022
1 parent 718c3ba commit e109022
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e109022

Please sign in to comment.