summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2017-03-03 23:22:54 -0500
committerJoe Wilm <jwilm@users.noreply.github.com>2017-03-04 15:49:10 -0800
commitaa76b29ff7dbf4af8d83c9f461889249fe53ea77 (patch)
treec5bd36946054bf8e06d89a2f34cba3c39c035e14 /src
parentd7c0b1115a8d03bc6fab6a165a9aa67c1dc64b87 (diff)
Handle CSI command J3 (Clear saved lines)
Xterm supports an extension to the CSI command `Erase in Display (ED)`, under the command number 3. This command is used to clear the scrollback buffer - e.g. anything not visible on the screen. Since scrollback is not part of alacritty, the handler for this command currently does nothing. If at some point scrollback is implemented, the corresponding `match` arm can be modified to properly handle this. For an example of a program which uses this command, run the `clear` command (using ncurses 6.0). In a supported terminal such as `gnome-terminal`, this will clear anything off of the screen from the scrollback buffer. Before this change, `alacritty` would generate an `Unhandled CSI` message.
Diffstat (limited to 'src')
-rw-r--r--src/ansi.rs3
-rw-r--r--src/term/mod.rs4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index c37f2090..d2c255a5 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -330,6 +330,8 @@ pub enum ClearMode {
Above,
/// Clear entire terminal
All,
+ /// Clear 'saved' lines (scrollback)
+ Saved
}
/// Mode for clearing tab stops
@@ -709,6 +711,7 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
0 => ClearMode::Below,
1 => ClearMode::Above,
2 => ClearMode::All,
+ 3 => ClearMode::Saved,
_ => unhandled!(),
};
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 08299987..4ee685b1 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -1443,7 +1443,9 @@ impl ansi::Handler for Term {
for cell in &mut self.grid[self.cursor.point.line][..self.cursor.point.col] {
cell.reset(&template);
}
- }
+ },
+ // If scrollback is implemented, this should clear it
+ ansi::ClearMode::Saved => return
}
}