Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cjk handling in SerializeAddon #3067

Merged
merged 1 commit into from
Sep 8, 2020

Conversation

mmis1000
Copy link
Contributor

@mmis1000 mmis1000 commented Sep 3, 2020

Use cell.getWidth() to get correct cell width instead of assume 1 width of every empty cell.

if (cell.getChars() === '') {
this._nullCellCount++;
} else if (this._nullCellCount > 0) {

Fix #3066

@Tyriar Tyriar added this to the 4.9.0 milestone Sep 3, 2020
Copy link
Member

@jerch jerch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find, LGTM 👍

On the background of this: We actually have 2 types of null cells - the default one has a width of 1, which still accounts towards cursor offsets and has a default output representation of one SP. The second one appears after full width chars with a width of 0, which does not account anywhere and has no own output repr. Thus it is important to grab the true cell width for nullish cells to correctly calculate cursor offsets and/or filling spaces afterwards.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@Tyriar Tyriar merged commit 33bf765 into xtermjs:master Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xterm-addon-serialize incorrectly handle double width charaters (a.k.a. CJK)
3 participants