aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-01-09 23:06:41 +0000
committerGitHub <noreply@github.com>2020-01-09 23:06:41 +0000
commit3fb631b91caec163707858bd1d435015e6e6cb18 (patch)
treecfc575f224622b7c83a21281c2e23a7f8af83364 /alacritty/src
parent5651c3f7114dff611e616865ad02e682779979d9 (diff)
downloadr-alacritty-3fb631b91caec163707858bd1d435015e6e6cb18.tar.gz
r-alacritty-3fb631b91caec163707858bd1d435015e6e6cb18.tar.bz2
r-alacritty-3fb631b91caec163707858bd1d435015e6e6cb18.zip
Fix cut off full width glyphs in last column
This resolves the issue with full width glyphs getting rendered in the last column. Since they need at least two glyphs, it is not possible to properly render them in the last column. Instead of rendering half of the glyph in the last column, with the other half cut off, an additional spacer is now inserted before the wide glyph. This means that the specific glyph in question is then three cells wide. Fixes #2385.
Diffstat (limited to 'alacritty/src')
-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) {