From 679e67d045f60d528c695a1ee8a6c0f3d6feeda1 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Mon, 4 Nov 2019 20:41:42 +0100 Subject: [PATCH] Fix URL scheme highlighting --- alacritty/src/url.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs index 849e7a4e..43503f60 100644 --- a/alacritty/src/url.rs +++ b/alacritty/src/url.rs @@ -130,8 +130,12 @@ impl Urls { }, (UrlLocation::Scheme, _) => { if let Some(url) = self.urls.last_mut() { - if url.lines[url.lines.len() - 1].color != cell.fg { - url.lines.push(RenderLine { start: point, end: point, color: cell.fg }); + if let Some(last_line) = url.lines.last_mut() { + if last_line.color == cell.fg { + last_line.end = point; + } else { + url.lines.push(RenderLine { start: point, end: point, color: cell.fg }); + } } } }, @@ -173,6 +177,11 @@ impl Urls { } fn reset(&mut self) { + // Remove temporarily stored scheme URLs + if let UrlLocation::Scheme = self.state { + self.urls.pop(); + } + self.locator = UrlLocator::new(); self.state = UrlLocation::Reset; }