mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
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.
This commit is contained in:
parent
d7c0b1115a
commit
aa76b29ff7
2 changed files with 6 additions and 1 deletions
|
@ -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!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue