diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-11-08 00:03:11 +0100 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2018-11-10 18:19:05 +0100 |
commit | 9afd143850195db51cd8ab319a5395d29762a098 (patch) | |
tree | 4f6fac410550c07300a1e49f02b96dcb979fdbe4 | |
parent | 1e80a2e757134e602400c8d925558c986e3555d1 (diff) | |
download | alacritty-9afd143850195db51cd8ab319a5395d29762a098.tar.gz alacritty-9afd143850195db51cd8ab319a5395d29762a098.zip |
Fix failing tests
-rw-r--r-- | src/input.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/term/mod.rs | 30 | ||||
-rw-r--r-- | tests/ref.rs | 2 |
4 files changed, 19 insertions, 17 deletions
diff --git a/src/input.rs b/src/input.rs index d2f8f6b5..dd6233fb 100644 --- a/src/input.rs +++ b/src/input.rs @@ -908,7 +908,7 @@ mod tests { dpr: 1.0, }; - let mut terminal = Term::new(&config, size); + let mut terminal = Term::new(&config, size, None); let mut mouse = Mouse::default(); mouse.click_state = $initial_state; diff --git a/src/main.rs b/src/main.rs index 1498c14a..8035deb9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -138,7 +138,7 @@ fn run( // This object contains all of the state about what's being displayed. It's // wrapped in a clonable mutex since both the I/O loop and display need to // access it. - let terminal = Term::new(&config, display.size().to_owned(), logger_proxy); + let terminal = Term::new(&config, display.size().to_owned(), Some(logger_proxy)); let terminal = Arc::new(FairMutex::new(terminal)); // Find the window ID for setting $WINDOWID 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'; diff --git a/tests/ref.rs b/tests/ref.rs index 74cac6fa..b378cc0c 100644 --- a/tests/ref.rs +++ b/tests/ref.rs @@ -90,7 +90,7 @@ fn ref_test(dir: &Path) { let mut config: Config = Default::default(); config.set_history(ref_config.history_size); - let mut terminal = Term::new(&config, size); + let mut terminal = Term::new(&config, size, None); let mut parser = ansi::Processor::new(); for byte in recording { |