From a1febb52bd2ac5cec0902e2e060c2cafeaf9afa8 Mon Sep 17 00:00:00 2001 From: denis Date: Tue, 5 Jan 2021 11:52:12 +0200 Subject: [PATCH] fix: fixes #130 by adding overflowing_sub --- src/terminal_pane/scroll.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/terminal_pane/scroll.rs b/src/terminal_pane/scroll.rs index 6301c7c1..0c94a0d8 100644 --- a/src/terminal_pane/scroll.rs +++ b/src/terminal_pane/scroll.rs @@ -1,4 +1,4 @@ -use std::collections::VecDeque; +use std::{collections::VecDeque}; use std::fmt::{self, Debug, Formatter}; use crate::terminal_pane::terminal_character::{ @@ -266,7 +266,7 @@ impl CursorPosition { self.column_index += count; } pub fn move_backwards(&mut self, count: usize) { - self.column_index -= count; + self.column_index = u32::overflowing_sub(self.column_index as u32, count as u32).0 as usize; } pub fn move_to_next_linewrap(&mut self) { self.line_index.1 += 1;