fix wrapping issue with double-wide cells and hyperlink rules

We weren't including the invisible space cells into the model
as part of building up the logical line, resulting in the logical
line being shorter than it should have been.

That resulted in some of the components of the double wide cells
not being rendered in the correct place.

refs: https://github.com/wez/wezterm/issues/2571
refs: https://github.com/wez/wezterm/issues/2568
This commit is contained in:
Wez Furlong committed 2022-10-12 09:23:21 -07:00
1 parent 0d78261a30
commit 13e57fa0b5
3 files changed
+21

No files matched your search

+3
View File
@@ -87,6 +87,9 @@ As features stabilize some brief notes about them will accumulate here.
* Multiple active multiplexer client domain connections could result
in showing duplicate tabs in a window
[#2616](https://github.com/wez/wezterm/issues/2616)
* Incorrect line width when applying hyperlink rules to a wrapped line
containing double-wide cells.
[#2568](https://github.com/wez/wezterm/issues/2568)
#### Changed
* Removed Last Resort fallback font
+3
View File
@@ -1097,6 +1097,9 @@ impl Line {
CellStorage::V(cells) => {
for cell in other.visible_cells() {
cells.push(cell.as_cell());
for _ in 1.. cell.width() {
cells.push(Cell::new(' ', cell.attrs().clone()));
}
}
}
CellStorage::C(cl) => {
+15
View File
@@ -8,6 +8,21 @@ use crate::surface::SEQ_ZERO;
use k9::assert_equal as assert_eq;
use std::sync::Arc;
/// There are 4 double-wide graphemes that occupy 2 cells each.
/// When we join the lines, we must preserve the invisible blank
/// that is part of the grapheme otherwise our metrics will be
/// wrong.
/// <https://github.com/wez/wezterm/issues/2568>
#[test]
fn append_line() {
let mut line1: Line = "0123456789".into();
let line2: Line = "グループaa".into();
line1.append_line(line2, SEQ_ZERO);
assert_eq!(line1.len(), 20);
}
#[test]
fn hyperlinks() {
let text = "❤ 😍🤢 http://example.com \u{1f468}\u{1f3fe}\u{200d}\u{1f9b0} http://example.com";