aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-02-06 13:13:25 -0800
committerJoe Wilm <jwilm@users.noreply.github.com>2017-02-07 08:08:08 -0800
commit1852707af3ebd3f261d72b46bd110ccbbbc5a51d (patch)
tree452f583b536ef7777b30a09644d22d9f026b7f4c
parent098eca8d10156d450f3abcca74cb26febe93b7a9 (diff)
downloadalacritty-1852707af3ebd3f261d72b46bd110ccbbbc5a51d.tar.gz
alacritty-1852707af3ebd3f261d72b46bd110ccbbbc5a51d.zip
Implement clearing above cursor
-rw-r--r--src/term/mod.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 58a5b314..0dc5532c 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -1137,8 +1137,20 @@ impl ansi::Handler for Term {
ansi::ClearMode::All => {
self.grid.clear(|c| c.reset(&template));
},
- _ => {
- trace!("ansi::ClearMode::Above not implemented");
+ ansi::ClearMode::Above => {
+ // If clearing more than one line
+ if self.cursor.point.line > Line(1) {
+ // Fully clear all lines before the current line
+ for row in &mut self.grid[..self.cursor.point.line] {
+ for cell in row {
+ cell.reset(&template);
+ }
+ }
+ }
+ // Clear up to the current column in the current line
+ for cell in &mut self.grid[self.cursor.point.line][..self.cursor.point.col] {
+ cell.reset(&template);
+ }
}
}
}