fix: error that caused usize to overflow (#3024)

* fix: error that caused usize to overflow

* update: changed check_sub to saturating_sub
pull/3026/head
Slug 2 years ago committed by GitHub
parent 718c3baebe
commit e109022bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1414,7 +1414,7 @@ fn copy_selection_on_line(cx: &mut Context, direction: Direction) {
let (head, anchor) = if range.anchor < range.head { let (head, anchor) = if range.anchor < range.head {
(range.head - 1, range.anchor) (range.head - 1, range.anchor)
} else { } else {
(range.head, range.anchor - 1) (range.head, range.anchor.saturating_sub(1))
}; };
let tab_width = doc.tab_width(); let tab_width = doc.tab_width();

Loading…
Cancel
Save