unicode-display_width icon indicating copy to clipboard operation
unicode-display_width copied to clipboard

Variation Selector-16 Support

Open jquast opened this issue 1 year ago • 1 comments

Hello,

There is a set of Emoji characters that are displayed Narrow, such as U+23F1 (Stopwatch) which unicode-display_width correctly measures as 1.

But, when joined in sequence with U+FE0F (Variation Selector-16), they become wide. This is a bit rare, as currently it is true for only 7 of ~24 popular terminals. It took me years to fully understand what the heck was going on...

You might be interested in the Specification that I have written for the python wcwidth library, the ucs-detect used to asses terminal compliance, and the test results of more than 20 popular terminals.

I have written about all of those things in this article https://www.jeffquast.com/post/ucs-detect-test-results/

jquast avatar Dec 17 '23 17:12 jquast

require 'unicode/display_width'

display_width = Unicode::DisplayWidth.new(emoji: true)

puts display_width.of "\u23F1" # => 1
puts display_width.of "\u23F1\uFE0F" # => 1 .. should be 2

outputs

1
1

jquast avatar Dec 17 '23 17:12 jquast