diff options
Diffstat (limited to 'alacritty/src/url.rs')
-rw-r--r-- | alacritty/src/url.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs index e538331d..fcdd477f 100644 --- a/alacritty/src/url.rs +++ b/alacritty/src/url.rs @@ -147,6 +147,7 @@ impl Urls { url.end_offset = end_offset; } + /// Find URL below the mouse cursor. pub fn highlighted( &self, config: &Config, @@ -171,12 +172,16 @@ impl Urls { return None; } + self.find_at(Point::new(mouse.line, mouse.column)) + } + + /// Find URL at location. + pub fn find_at(&self, point: Point) -> Option<Url> { for url in &self.urls { - if (url.start()..=url.end()).contains(&Point::new(mouse.line, mouse.column)) { + if (url.start()..=url.end()).contains(&point) { return Some(url.clone()); } } - None } |