diff options
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index b47e6dcb..8a8ae197 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -813,7 +813,7 @@ pub struct Term { auto_scroll: bool, /// Proxy object for clearing displayed errors and warnings - logger_proxy: LoggerProxy, + logger_proxy: Option<LoggerProxy>, } /// Terminal size info @@ -896,7 +896,7 @@ impl Term { self.next_mouse_cursor.take() } - pub fn new(config: &Config, size: SizeInfo, logger_proxy: LoggerProxy) -> Term { + pub fn new(config: &Config, size: SizeInfo, logger_proxy: Option<LoggerProxy>) -> Term { let num_cols = size.cols(); let num_lines = size.lines(); @@ -1828,7 +1828,9 @@ impl ansi::Handler for Term { }, ansi::ClearMode::All => { // Clear displayed errors and warnings - self.logger_proxy.clear(); + if let Some(ref mut logger_proxy) = self.logger_proxy { + logger_proxy.clear(); + } self.grid.region_mut(..).each(|c| c.reset(&template)); }, @@ -2079,7 +2081,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let mut grid: Grid<Cell> = Grid::new(Line(3), Column(5), 0, Cell::default()); for i in 0..5 { for j in 0..2 { @@ -2123,7 +2125,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let mut grid: Grid<Cell> = Grid::new(Line(1), Column(5), 0, Cell::default()); for i in 0..5 { grid[Line(0)][Column(i)].c = 'a'; @@ -2149,7 +2151,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let mut grid: Grid<Cell> = Grid::new(Line(3), Column(3), 0, Cell::default()); for l in 0..3 { if l != 1 { @@ -2194,7 +2196,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let cursor = Point::new(Line(0), Column(0)); term.configure_charset(CharsetIndex::G0, StandardCharset::SpecialCharacterAndLineDrawing); @@ -2214,7 +2216,7 @@ mod tests { dpr: 1.0, }; let config: Config = Default::default(); - let mut term: Term = Term::new(&config, size); + let mut term: Term = Term::new(&config, size, None); term.change_font_size(font_size); let expected_font_size: Size = config.font().size() + Size::new(font_size); @@ -2243,7 +2245,7 @@ mod tests { dpr: 1.0, }; let config: Config = Default::default(); - let mut term: Term = Term::new(&config, size); + let mut term: Term = Term::new(&config, size, None); term.change_font_size(-100.0); @@ -2263,7 +2265,7 @@ mod tests { dpr: 1.0, }; let config: Config = Default::default(); - let mut term: Term = Term::new(&config, size); + let mut term: Term = Term::new(&config, size, None); term.change_font_size(10.0); term.reset_font_size(); @@ -2284,7 +2286,7 @@ mod tests { dpr: 1.0 }; let config: Config = Default::default(); - let mut term: Term = Term::new(&config, size); + let mut term: Term = Term::new(&config, size, None); // Add one line of scrollback term.grid.scroll_up(&(Line(0)..Line(1)), Line(1), &Cell::default()); @@ -2310,7 +2312,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let mut grid: Grid<Cell> = Grid::new(Line(1), Column(15), 0, Cell::default()); grid[Line(0)][Column(0)].c = '('; grid[Line(0)][Column(1)].c = '('; @@ -2346,7 +2348,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let mut grid: Grid<Cell> = Grid::new(Line(1), Column(15), 0, Cell::default()); grid[Line(0)][Column(0)].c = 'f'; grid[Line(0)][Column(1)].c = 't'; @@ -2381,7 +2383,7 @@ mod tests { padding_y: 0.0, dpr: 1.0, }; - let mut term = Term::new(&Default::default(), size); + let mut term = Term::new(&Default::default(), size, None); let mut grid: Grid<Cell> = Grid::new(Line(1), Column(15), 0, Cell::default()); grid[Line(0)][Column(0)].c = 'a'; grid[Line(0)][Column(1)].c = 'z'; |