diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-05-30 20:45:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-30 20:45:44 +0000 |
commit | 1dacc99183373bffa3ba287aa3241f3b1da67016 (patch) | |
tree | d5dbefde927b02bff10e29d8596a0bfab65d88f1 /alacritty_terminal/src/grid/row.rs | |
parent | f7fb67f870943f3f760826b748c8463b8e434983 (diff) | |
download | r-alacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.tar.gz r-alacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.tar.bz2 r-alacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.zip |
Refactor Term/Grid separation
This commit aims to clear up the separation between Term and Grid to
make way for implementing search.
The `cursor` and `cursor_save` have been moved to the grid, since
they're always bound to their specific grid and this makes updating
easier.
Since the selection is independent of the active grid, it has been moved
to the `Term`.
Diffstat (limited to 'alacritty_terminal/src/grid/row.rs')
-rw-r--r-- | alacritty_terminal/src/grid/row.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/alacritty_terminal/src/grid/row.rs b/alacritty_terminal/src/grid/row.rs index 22a10625..b5248ad7 100644 --- a/alacritty_terminal/src/grid/row.rs +++ b/alacritty_terminal/src/grid/row.rs @@ -43,20 +43,20 @@ impl<T: PartialEq> PartialEq for Row<T> { } impl<T: Copy> Row<T> { - pub fn new(columns: Column, template: &T) -> Row<T> + pub fn new(columns: Column, template: T) -> Row<T> where T: GridCell, { let occ = if template.is_empty() { 0 } else { columns.0 }; - Row { inner: vec![*template; columns.0], occ } + Row { inner: vec![template; columns.0], occ } } - pub fn grow(&mut self, cols: Column, template: &T) { + pub fn grow(&mut self, cols: Column, template: T) { if self.inner.len() >= cols.0 { return; } - self.inner.append(&mut vec![*template; cols.0 - self.len()]); + self.inner.append(&mut vec![template; cols.0 - self.len()]); } pub fn shrink(&mut self, cols: Column) -> Option<Vec<T>> @@ -83,14 +83,12 @@ impl<T: Copy> Row<T> { /// Reset all cells in the row to the `template` cell. #[inline] - pub fn reset(&mut self, template: &T) + pub fn reset(&mut self, template: T) where T: GridCell + PartialEq, { debug_assert!(!self.inner.is_empty()); - let template = *template; - // Mark all cells as dirty if template cell changed. let len = self.inner.len(); if !self.inner[len - 1].fast_eq(template) { |