aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/url.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/url.rs')
-rw-r--r--alacritty/src/url.rs29
1 files changed, 16 insertions, 13 deletions
diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs
index e510aa2b..b32a6812 100644
--- a/alacritty/src/url.rs
+++ b/alacritty/src/url.rs
@@ -42,7 +42,7 @@ impl Url {
}
pub fn end(&self) -> Point {
- self.lines[self.lines.len() - 1].end.sub(self.num_cols, self.end_offset as usize)
+ self.lines[self.lines.len() - 1].end.sub(self.num_cols, self.end_offset as usize, false)
}
}
@@ -73,11 +73,6 @@ impl Urls {
// Update tracked URLs
pub fn update(&mut self, num_cols: usize, cell: RenderableCell) {
- // Ignore double-width spacers to prevent reset
- if cell.flags.contains(Flags::WIDE_CHAR_SPACER) {
- return;
- }
-
// Convert cell to character
let c = match cell.inner {
RenderableCellContent::Chars(chars) => chars[0],
@@ -85,20 +80,28 @@ impl Urls {
};
let point: Point = cell.into();
- let mut end = point;
+ let end = point;
// Reset URL when empty cells have been skipped
- if point != Point::default() && Some(point.sub(num_cols, 1)) != self.last_point {
+ if point != Point::default() && Some(point.sub(num_cols, 1, false)) != self.last_point {
self.reset();
}
- // Extend by one cell for double-width characters
- if cell.flags.contains(Flags::WIDE_CHAR) {
- end.col += 1;
- }
-
self.last_point = Some(end);
+ // Extend current state if a wide char spacer is encountered
+ if cell.flags.contains(Flags::WIDE_CHAR_SPACER) {
+ if let UrlLocation::Url(_, mut end_offset) = self.state {
+ if end_offset != 0 {
+ end_offset += 1;
+ }
+
+ self.extend_url(point, end, cell.fg, end_offset);
+ }
+
+ return;
+ }
+
// Advance parser
let last_state = mem::replace(&mut self.state, self.locator.advance(c));
match (self.state, last_state) {