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

Some characters do false-positively count as 2 while occupying 1 column in terminal #56

Open
erictheswift opened this issue Feb 8, 2024 · 3 comments

Comments

@erictheswift
Copy link

erictheswift commented Feb 8, 2024

stringWidth('◼') // 2 in v7, 1 in v5
stringWidth('⚠') // 2 in v7, 1 in v5
stringWidth('✔') // 2 in v7, 1 in v5
(likely not complete list)

seems related to emoji-regex package updates

I guess it is not true that every character considered as emoji due to spec occupies double width. At least at current moment in time.
mathiasbynens/emoji-regex#33

@fabiospampinato
Copy link

fabiospampinato commented Feb 26, 2024

More test cases where this happens, emoji-regex seems indeed potentially buggy:

t.is(stringWidth('\u21a9'), 1);
t.is(stringWidth('\u2194'), 1);
t.is(stringWidth('\u2197'), 1);
t.is(stringWidth('✔'), 1);
t.is(stringWidth('\u2709'), 1);
t.is(stringWidth('\u26a0'), 1);

@unlessgames
Copy link

I get the same issue with for example. Until resolved, one can stick with version ^5.1.2.

@simnalamburt
Copy link

I got the same issue with and in v7 and v6. I'm sticking with v5.1.2 too.

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

No branches or pull requests

4 participants