Handle overflow in Term::move_backward

Resolves #25
This commit is contained in:
Joe Wilm 2016-12-15 09:09:49 -08:00
parent 1a1b740c38
commit 0b3d2dac44
1 changed files with 5 additions and 1 deletions

View File

@ -557,7 +557,11 @@ impl ansi::Handler for Term {
#[inline]
fn move_backward(&mut self, cols: Column) {
debug_println!("move_backward: {}", cols);
self.cursor.col -= cols;
if cols > self.cursor.col {
self.cursor.col = Column(0);
} else {
self.cursor.col -= cols;
}
}
#[inline]