aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-10 10:14:45 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-10 10:14:45 -0800
commitb6c372ab4800b8dbc9e3efb042e369c9980c607a (patch)
treebe7518b00a4b5a8cc46b90d7b43d82031299120b
parentd19e6e38a425063133596aa454ccbf6f82d8b7d6 (diff)
downloadalacritty-b6c372ab4800b8dbc9e3efb042e369c9980c607a.tar.gz
alacritty-b6c372ab4800b8dbc9e3efb042e369c9980c607a.zip
Use checked subtraction for backspace
Some shells will send a backspace at column 0, apparently.
-rw-r--r--src/term.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/term.rs b/src/term.rs
index b4ac14af..33890ad5 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -570,7 +570,9 @@ impl ansi::Handler for Term {
#[inline]
fn backspace(&mut self) {
debug_println!("backspace");
- self.cursor.col -= 1;
+ if self.cursor.col > Column(0) {
+ self.cursor.col -= 1;
+ }
}
/// Carriage return