diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-08-03 13:19:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-03 13:19:33 +0000 |
commit | 5a40149069c91f63f9dcbf5fb46b36144b30eb95 (patch) | |
tree | 8503ba4ad05ac7e77268a29809c2800cd24da1b0 /alacritty_terminal/src/url.rs | |
parent | 9dddf649a15d103295f4ce97b8ae4c178c9623e0 (diff) | |
download | r-alacritty-5a40149069c91f63f9dcbf5fb46b36144b30eb95.tar.gz r-alacritty-5a40149069c91f63f9dcbf5fb46b36144b30eb95.tar.bz2 r-alacritty-5a40149069c91f63f9dcbf5fb46b36144b30eb95.zip |
Move modifier check before URL search
This makes sure that the URL search is only initiated when all required
modifiers are held down. This should improve performance with long URLs.
Diffstat (limited to 'alacritty_terminal/src/url.rs')
-rw-r--r-- | alacritty_terminal/src/url.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/alacritty_terminal/src/url.rs b/alacritty_terminal/src/url.rs index f1b7934b..292f8358 100644 --- a/alacritty_terminal/src/url.rs +++ b/alacritty_terminal/src/url.rs @@ -18,14 +18,17 @@ impl Url { Url { end: Point::new(end_line, Column(end_col)), start } } + /// Check if point is within this URL pub fn contains(&self, point: impl Into<Point<usize>>) -> bool { let point = point.into(); + point.line <= self.start.line && point.line >= self.end.line && (point.line != self.start.line || point.col >= self.start.col) && (point.line != self.end.line || point.col <= self.end.col) } + /// Convert URLs bounding points to linear indices pub fn linear_bounds(&self, terminal: &Term) -> RangeInclusive<Linear> { let mut start = self.start; let mut end = self.end; |