summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/grid/tests.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2019-12-10 00:35:13 +0100
committerGitHub <noreply@github.com>2019-12-10 00:35:13 +0100
commit36185c47533d6189c9116df7a41a13766ca2b40c (patch)
tree80089a2da7de8701f59b1e692041f0de06c01aee /alacritty_terminal/src/grid/tests.rs
parent79b19176eeb57fbd6b137160afd6bc9f5518ad33 (diff)
downloadalacritty-36185c47533d6189c9116df7a41a13766ca2b40c.tar.gz
alacritty-36185c47533d6189c9116df7a41a13766ca2b40c.zip
Fix colored row reset performance
This fixes a bug where a row would always get reset completely if its background does not equal the default terminal background. This leads to big performance bottlenecks when running commands like `echo "\e[41m" && yes`. Instead of resetting the entire row whenever the template cell is not empty, the template cell is now compared to the last cell in the row. The last cell will always be equal to the previous template cell when `row.occ < row.inner.len()` and if `occ` is equal to the row's length, the entire row is always reset anyways. Fixes #2989.
Diffstat (limited to 'alacritty_terminal/src/grid/tests.rs')
-rw-r--r--alacritty_terminal/src/grid/tests.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/alacritty_terminal/src/grid/tests.rs b/alacritty_terminal/src/grid/tests.rs
index d28e7833..f3480b14 100644
--- a/alacritty_terminal/src/grid/tests.rs
+++ b/alacritty_terminal/src/grid/tests.rs
@@ -29,6 +29,10 @@ impl GridCell for usize {
}
fn set_wrap(&mut self, _wrap: bool) {}
+
+ fn fast_eq(&self, other: Self) -> bool {
+ self == &other
+ }
}
// Scroll up moves lines upwards