Lazy web, is there a way in @rustlang to calculate the number of columns a character will take up when drawn monospace? (eg CJK sometimes being 2, etc)
Found https://github.com/unicode-rs/unicode-width … but it seems to return a number that isn't the number of columns after the character is drawn.
-
-
I don't know of a good off the shelf solution, but a good bet is to evaluate is-emoji for the first code point and then count grapheme clusters (unicode-segmentation can do that). 2/2
-
Thanks! That's very helpful
- 2 more replies
New conversation -
-
-
That might explain some behavior I'm seeing where visual spaces seem to be being added in places. Maybe emoji shouldn't be part of my text UI!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.