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

@ -111,6 +111,11 @@ describe("wrapTextWithAnsi", () => {
}
});
it("should treat isolated regional indicators as width 2", () => {
assert.strictEqual(visibleWidth("🇨"), 2);
assert.strictEqual(visibleWidth("🇨🇳"), 2);
});
it("should truncate trailing whitespace that exceeds width", () => {
const twoSpacesWrappedToWidth1 = wrapTextWithAnsi(" ", 1);
assert.ok(visibleWidth(twoSpacesWrappedToWidth1[0]) <= 1);