1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Fix URL scheme highlighting

This commit is contained in:
Christian Duerr 2019-11-04 20:41:42 +01:00 committed by GitHub
parent 2c671afb69
commit 679e67d045
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}