1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

tabbar: fix double wide characters in tab titles

refs: #1371
This commit is contained in:
Wez Furlong 2021-12-09 08:34:19 -07:00
parent 4dd014b14e
commit b9aec2fcad
2 changed files with 9 additions and 1 deletions

View File

@ -23,6 +23,7 @@ As features stabilize some brief notes about them will accumulate here.
* DECSTR (terminal soft reset) now turns off DECLRMM (left and right margin mode). Thanks to [@ninjalj](https://github.com/ninjalj)! [#1376](https://github.com/wez/wezterm/pull/1376)
* Improved conformance of CUP, HVP, SLRM, STBM escape sequences by support empty first parameter. Thanks to [@ninjalj](https://github.com/ninjalj)! [#1377](https://github.com/wez/wezterm/pull/1377)
* tab bar didn't correctly handle double-wide cells and could truncate at edges when using `format-tab-title` [#1371](https://github.com/wez/wezterm/issues/1371)
### 20211205-192649-672c1cc1

View File

@ -382,7 +382,14 @@ fn parse_status_text(text: &str, default_cell: CellAttributes) -> Line {
fn flush_print(buf: &mut String, cells: &mut Vec<Cell>, pen: &CellAttributes) {
for g in unicode_segmentation::UnicodeSegmentation::graphemes(buf.as_str(), true) {
cells.push(Cell::new_grapheme(g, pen.clone()));
let cell = Cell::new_grapheme(g, pen.clone());
let width = cell.width();
cells.push(cell);
for _ in 1..width {
// Line/Screen expect double wide graphemes to be followed by a blank in
// the next column position, otherwise we'll render incorrectly
cells.push(Cell::blank_with_attrs(pen.clone()));
}
}
buf.clear();
}