fix(cli): draw grapheme clusters whole in the theme preview
The +list-themes interactive preview dropped the second emoji of ZWJ clusters (e.g. woman + ZWJ + rocket) in the search box. Zig's libvaxis enables Unicode grapheme mode 2027 for its session and sizes text per grapheme cluster; the Rust preview did neither, so the terminal split the cluster at the ZWJ and the cursor column was computed from summed per-codepoint widths (4 instead of 2). - The preview sends ?2027h on entry and ?2027l on exit like vaxis. - tui::gwidth follows vaxis's unicode width rules per grapheme cluster (VS15/VS16, emoji presentation, regional-indicator pairs) using the ghostty-unicode emoji table; the preview's print path uses it. +list-colors and +list-keybinds pretty output (also using gwidth) stays byte-identical to /usr/bin/ghostty at widths 40/80/132. Test Plan: - cargo test -p ghostty-cli --test list_themes_pty zwj_emoji_cluster_is_drawn_whole_in_search_box - cargo test --workspace --no-fail-fast
This commit is contained in:
1 parent
03045f6ece
commit
f687a8c585
5 files changed
+84
-5
No files matched your search
@@ -380,3 +380,10 @@ fn load_file_error_exits_the_preview() {
|
||||
}
|
||||
assert!(code.is_some(), "the preview must have exited");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zwj_emoji_cluster_is_drawn_whole_in_search_box() {
|
||||
let cluster = "\u{1F469}\u{200D}\u{1F680}";
|
||||
let typed = format!("a{cluster}b");
|
||||
check_trace(&[typed.as_bytes()], &[&typed]);
|
||||
}
|
||||
Reference in new issue
Block a user