aboutsummaryrefslogtreecommitdiff
path: root/src/term
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-01-14 10:17:08 -0800
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:24:38 -0700
commit350bb8c800232ce0b27512420e99645ec8b95ef1 (patch)
tree7e5b4ecb3d77416b009f0dc26bdf24e50165fb67 /src/term
parenta88961bbf01299cef3b675a30575a7d23c5c485a (diff)
downloadr-alacritty-350bb8c800232ce0b27512420e99645ec8b95ef1.tar.gz
r-alacritty-350bb8c800232ce0b27512420e99645ec8b95ef1.tar.bz2
r-alacritty-350bb8c800232ce0b27512420e99645ec8b95ef1.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')
-rw-r--r--src/term/mod.rs27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index c405490e..efcafc25 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -800,7 +800,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())
@@ -1066,9 +1066,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();
@@ -1133,17 +1132,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);
}
@@ -1157,15 +1145,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);
}