mattn / go-runewidth

wcwidth for golang
MIT License
609 stars 94 forks source link

Wrong width for flag symbols #39

Open abrander opened 4 years ago

abrander commented 4 years ago

runewidth.StringWidth(🇩🇰) returns 2.

I haven't looked into this at all, and I have no idea what I should expect, but a width of 1 seems reasonable.

eteran commented 4 years ago

Likely related: https://www.youtube.com/watch?v=sTzp76JXsoY

ghostsquad commented 4 years ago

The problem, as described in the video, is that it's technically 2 characters, with the renderer collapsing it to 1 character. So I think it's ill advised to change it from 2 to one, as it would break any renderer that doesn't support flag emojis.

gdamore commented 3 years ago

Looking at this in a bit more detail, I think the flag symbols need special handling in the renderer.

However, they definitely count as emoji, and should be displayed using the Emoji Presentation property.

hhirtz commented 3 years ago

Duplicate of #28?