diff options
author | Joe Wilm <joe@jwilm.com> | 2018-01-14 10:17:08 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-01-14 10:17:08 -0800 |
commit | d0a1ff47367193d1cc3947d0599489f6ce7091cb (patch) | |
tree | bd52f1d112dc708c21f64177b2d92f3160580442 /src/term/mod.rs | |
parent | 44f58b81f296ac1f3a73f93c35537c4b531bb5d7 (diff) | |
download | alacritty-d0a1ff47367193d1cc3947d0599489f6ce7091cb.tar.gz alacritty-d0a1ff47367193d1cc3947d0599489f6ce7091cb.zip |
Use memcpy for resetting row contents
In addition to a marginal performance improvement, this simplifies some
logic in the Term implementation since now the Grid fully handles row
recycling.
Diffstat (limited to 'src/term/mod.rs')
-rw-r--r-- | src/term/mod.rs | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index d60a3f52..af3f5917 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -799,7 +799,7 @@ impl Term { let num_cols = size.cols(); let num_lines = size.lines(); - let grid = Grid::new(num_lines, num_cols, &template); + let grid = Grid::new(num_lines, num_cols, template); let tabspaces = config.tabspaces(); let tabs = IndexRange::from(Column(0)..grid.num_cols()) @@ -1064,9 +1064,8 @@ impl Term { debug!("num_cols, num_lines = {}, {}", num_cols, num_lines); // Resize grids to new size - let template = Cell::default(); - self.grid.resize(num_lines, num_cols, &template); - self.alt_grid.resize(num_lines, num_cols, &template); + self.grid.resize(num_lines, num_cols); + self.alt_grid.resize(num_lines, num_cols); // Reset scrolling region to new size self.scroll_region = Line(0)..self.grid.num_lines(); @@ -1131,17 +1130,6 @@ impl Term { trace!("scroll_down_relative: origin={}, lines={}", origin, lines); let lines = min(lines, self.scroll_region.end - self.scroll_region.start); - // Copy of cell template; can't have it borrowed when calling clear/scroll - let template = self.cursor.template; - - // Clear `lines` lines at bottom of area - { - let start = max(origin, Line(self.scroll_region.end.0.saturating_sub(lines.0))); - self.grid - .region_mut(start..self.scroll_region.end) - .each(|c| c.reset(&template)); - } - // Scroll between origin and bottom self.grid.scroll_down(&(origin..self.scroll_region.end), lines); } @@ -1155,15 +1143,6 @@ impl Term { trace!("scroll_up_relative: origin={}, lines={}", origin, lines); let lines = min(lines, self.scroll_region.end - self.scroll_region.start); - // Copy of cell template; can't have it borrowed when calling clear/scroll - let template = self.cursor.template; - - // Clear `lines` lines starting from origin to origin + lines - { - let end = min(origin + lines, self.scroll_region.end); - self.grid.region_mut(origin..end).each(|c| c.reset(&template)); - } - // Scroll from origin to bottom less number of lines self.grid.scroll_up(&(origin..self.scroll_region.end), lines); } |