diff options
author | Joe Wilm <joe@jwilm.com> | 2017-04-19 09:03:33 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2017-04-19 09:03:33 -0700 |
commit | 77295e7f9e04660598b0323924c142cde30429f4 (patch) | |
tree | b91b097c33d79fa790b0baa9423b863fb880d67e /src | |
parent | 197e910d63bea2a334d402a342b58e37f93b4b85 (diff) | |
download | alacritty-77295e7f9e04660598b0323924c142cde30429f4.tar.gz alacritty-77295e7f9e04660598b0323924c142cde30429f4.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/ansi.rs | 13 | ||||
-rw-r--r-- | src/term/mod.rs | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/ansi.rs b/src/ansi.rs index 2b71e537..cf7bbea2 100644 --- a/src/ansi.rs +++ b/src/ansi.rs @@ -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, diff --git a/src/term/mod.rs b/src/term/mod.rs index 9993d2b3..40fb58e1 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -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"); } |