diff options
author | Christian Duerr <contact@christianduerr.com> | 2019-11-04 20:41:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-04 20:41:42 +0100 |
commit | 679e67d045f60d528c695a1ee8a6c0f3d6feeda1 (patch) | |
tree | 36de2488339ea90177951b59c04411097af88216 | |
parent | 2c671afb69fb97f94df9967e7ffcf07d5e6a7be1 (diff) | |
download | alacritty-679e67d045f60d528c695a1ee8a6c0f3d6feeda1.tar.gz alacritty-679e67d045f60d528c695a1ee8a6c0f3d6feeda1.zip |
Fix URL scheme highlighting
-rw-r--r-- | alacritty/src/url.rs | 13 |
1 files 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; } |