diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-15 09:09:49 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-15 09:13:34 -0800 |
commit | 0b3d2dac4405c9f0124dc24db128eb31f47c3113 (patch) | |
tree | d279886cca81d4ea349096c0558dfbafc2681df3 | |
parent | 1a1b740c38cfbadff4cd985ee925ac024627d2b9 (diff) | |
download | alacritty-0b3d2dac4405c9f0124dc24db128eb31f47c3113.tar.gz alacritty-0b3d2dac4405c9f0124dc24db128eb31f47c3113.zip |
Handle overflow in Term::move_backward
Resolves #25
-rw-r--r-- | src/term/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index fb31af9b..93124732 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -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] |