aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-15 09:09:49 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-15 09:13:34 -0800
commit0b3d2dac4405c9f0124dc24db128eb31f47c3113 (patch)
treed279886cca81d4ea349096c0558dfbafc2681df3
parent1a1b740c38cfbadff4cd985ee925ac024627d2b9 (diff)
downloadalacritty-0b3d2dac4405c9f0124dc24db128eb31f47c3113.tar.gz
alacritty-0b3d2dac4405c9f0124dc24db128eb31f47c3113.zip
Handle overflow in Term::move_backward
Resolves #25
-rw-r--r--src/term/mod.rs6
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]