go-runewidth icon indicating copy to clipboard operation
go-runewidth copied to clipboard

Wrong width for flag symbols

Open abrander opened this issue 4 years ago • 4 comments

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.

abrander avatar Feb 28 '20 12:02 abrander

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

eteran avatar Jun 10 '20 21:06 eteran

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.

ghostsquad avatar Jun 29 '20 03:06 ghostsquad

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.

gdamore avatar Oct 17 '21 08:10 gdamore

Duplicate of #28?

hhirtz avatar Nov 04 '21 13:11 hhirtz