fix: fixes #130 by adding overflowing_sub

This commit is contained in:
denis 2021-01-05 11:52:12 +02:00
parent c7db38d0c5
commit a1febb52bd

View file

@ -1,4 +1,4 @@
use std::collections::VecDeque; use std::{collections::VecDeque};
use std::fmt::{self, Debug, Formatter}; use std::fmt::{self, Debug, Formatter};
use crate::terminal_pane::terminal_character::{ use crate::terminal_pane::terminal_character::{
@ -266,7 +266,7 @@ impl CursorPosition {
self.column_index += count; self.column_index += count;
} }
pub fn move_backwards(&mut self, count: usize) { 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) { pub fn move_to_next_linewrap(&mut self) {
self.line_index.1 += 1; self.line_index.1 += 1;