fix(tui): stabilize regional indicator width to prevent streaming render drift (#1783)

This commit is contained in:
Zhou Rui 2026-03-04 04:59:56 +08:00 committed by GitHub
parent d4084a7ad6
commit 85d06052fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 0 deletions

View file

@ -60,6 +60,13 @@ function graphemeWidth(segment: string): number {
return 0;
}
// Regional indicator symbols (U+1F1E6..U+1F1FF) are often rendered as
// full-width emoji in terminals, even when isolated during streaming.
// Keep width conservative (2) to avoid terminal auto-wrap drift artifacts.
if (cp >= 0x1f1e6 && cp <= 0x1f1ff) {
return 2;
}
let width = eastAsianWidth(cp);
// Trailing halfwidth/fullwidth forms