Fixed an accidental overflow bug when determining when to scroll text horizontally or not

This commit is contained in:
2023-08-08 10:50:05 -06:00
parent 6866f90329
commit 1b915a7f9a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ impl HorizontallyScrollableText {
}
pub fn scroll_or_reset(&self, width: usize, is_current_selection: bool) {
if is_current_selection && self.text.len() - 8 > width {
if is_current_selection && self.text.len().saturating_sub(4) > width {
self.scroll_text();
} else {
self.reset_offset();