top | item 37048434

(no title)

rivo | 2 years ago

I spent quite a bit of time coming up with an algorithm that gives me the correct width for any Unicode character, including emojis [1]. The reality is much more complicated than what wcwidth does and using the East Asian Width attribute will give wrong results, as outlined in the article.

Unfortunately, since a lot of terminals simply use wcwidth, you often have to use that same flawed algorithm in your application to make it work in those terminals.

[1] https://pkg.go.dev/github.com/rivo/uniseg#hdr-Monospace_Widt...

discuss

order

No comments yet.