In my terminal (Terminal.app), I can write the string:
Which consists of 6 instances of the code point U+1161 (a Korean character), as a single grapheme cluster.
In my terminal, each code point takes up 2 columns visually, for a total of 12 columns. But string-width reports the entire string as just being 2 columns wide. This seems like a bug.
I looked at the source code, and the culprit seems to be here: https://github.com/sindresorhus/string-width/blob/main/index.js#L111 , where it's just looking at the first code point of the grapheme cluster, rather than counting all of them.
In my terminal (Terminal.app), I can write the string:
Which consists of 6 instances of the code point
U+1161(a Korean character), as a single grapheme cluster.In my terminal, each code point takes up 2 columns visually, for a total of 12 columns. But
string-widthreports the entire string as just being 2 columns wide. This seems like a bug.I looked at the source code, and the culprit seems to be here: https://github.com/sindresorhus/string-width/blob/main/index.js#L111 , where it's just looking at the first code point of the grapheme cluster, rather than counting all of them.