From 77295e7f9e04660598b0323924c142cde30429f4 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Wed, 19 Apr 2017 09:03:33 -0700 Subject: 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. --- src/term/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/term/mod.rs') 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"); } -- cgit