1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00

Partially add DECCOLM support

It's not possible with DECCOLM to temporarily set 80 or 132 column mode
since the function is a toggle between the two. Instead, only the
additional affects are run in order to get closer to passing vttest.

vttest will never be perfect due to the column mode issue.
This commit is contained in:
Joe Wilm 2017-04-19 09:03:33 -07:00
parent 197e910d63
commit 77295e7f9e
2 changed files with 26 additions and 0 deletions

View file

@ -263,6 +263,18 @@ pub trait Handler {
pub enum Mode {
/// ?1
CursorKeys = 1,
/// Select 80 or 132 columns per page
///
/// CSI ? 3 h -> set 132 column font
/// CSI ? 3 l -> reset 80 column font
///
/// Additionally,
///
/// * set margins to default positions
/// * erases all data in page memory
/// * resets DECLRMM to unavailable
/// * clears data from the status line (if set to host-writable)
DECCOLM = 3,
/// ?6
Origin = 6,
/// ?7
@ -296,6 +308,7 @@ impl Mode {
if private {
Some(match num {
1 => Mode::CursorKeys,
3 => Mode::DECCOLM,
6 => Mode::Origin,
7 => Mode::LineWrap,
12 => Mode::BlinkingCursor,

View file

@ -1014,6 +1014,17 @@ impl Term {
self.grid.scroll_up(origin..end, lines);
}
}
fn deccolm(&mut self) {
// Setting 132 column font makes no sense, but run the other side effects
// Clear scrolling region
let scroll_region = Line(0)..self.grid.num_lines();
self.set_scrolling_region(scroll_region);
// Clear grid
let template = self.empty_cell;
self.grid.clear(|c| c.reset(&template));
}
}
impl ansi::TermInfo for Term {
@ -1572,6 +1583,7 @@ impl ansi::Handler for Term {
ansi::Mode::LineWrap => self.mode.insert(mode::LINE_WRAP),
ansi::Mode::LineFeedNewLine => self.mode.insert(mode::LINE_FEED_NEW_LINE),
ansi::Mode::Origin => self.mode.insert(mode::ORIGIN),
ansi::Mode::DECCOLM => self.deccolm(),
_ => {
debug!(".. ignoring set_mode");
}
@ -1596,6 +1608,7 @@ impl ansi::Handler for Term {
ansi::Mode::LineWrap => self.mode.remove(mode::LINE_WRAP),
ansi::Mode::LineFeedNewLine => self.mode.remove(mode::LINE_FEED_NEW_LINE),
ansi::Mode::Origin => self.mode.remove(mode::ORIGIN),
ansi::Mode::DECCOLM => self.deccolm(),
_ => {
debug!(".. ignoring unset_mode");
}