aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/display/damage.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2024-10-05 11:39:06 +0200
committerChristian Duerr <contact@christianduerr.com>2024-10-07 01:02:10 +0200
commita1ed79bd2c014be49a85e2100ce374b86c8839e8 (patch)
tree907f1e54be7447f310a9bef38165a5b2a314ea4a /alacritty/src/display/damage.rs
parent709738f7b50e06166b15be9f28e33a54b159150b (diff)
downloadr-alacritty-a1ed79bd2c014be49a85e2100ce374b86c8839e8.tar.gz
r-alacritty-a1ed79bd2c014be49a85e2100ce374b86c8839e8.tar.bz2
r-alacritty-a1ed79bd2c014be49a85e2100ce374b86c8839e8.zip
Fix highlight invalidation on grid scroll
This fixes an issue where hints highlighted by vi or mouse cursor would produce an underline on the incorrect line since the highlights only store the initial match boundaries without accounting for new content scrolling the terminal. To accurately invalidate the hint highlights, we use existing damage information of the current frame. The existing logic to damage hints for the next frame to account for removal has been changed, since the hints would otherwise be cleared immediately. Instead we now mark the terminal as fully damaged for the upcoming frame whenever the hints are cleared. Closes #7737.
Diffstat (limited to 'alacritty/src/display/damage.rs')
-rw-r--r--alacritty/src/display/damage.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/alacritty/src/display/damage.rs b/alacritty/src/display/damage.rs
index 450643b7..8efe0133 100644
--- a/alacritty/src/display/damage.rs
+++ b/alacritty/src/display/damage.rs
@@ -189,6 +189,15 @@ impl FrameDamage {
self.lines.push(LineDamageBounds::undamaged(line, num_cols));
}
}
+
+ /// Check if a range is damaged.
+ #[inline]
+ pub fn intersects(&self, start: Point<usize>, end: Point<usize>) -> bool {
+ self.full
+ || self.lines[start.line].left <= start.column
+ || self.lines[end.line].right >= end.column
+ || (start.line + 1..end.line).any(|line| self.lines[line].is_damaged())
+ }
}
/// Convert viewport `y` coordinate to [`Rect`] damage coordinate.