maticzav / ink-table

📐A table component for Ink.
184 stars 32 forks source link

Emoji's don't affect the width in columns 🤔 #249

Open benwinding opened 2 years ago

benwinding commented 2 years ago

See issue illustrated here

image

Kenneth-Sills commented 1 month ago

I think the arguably larger issue here would be how this affects CJK, which rely pretty heavily on fullwidth characters.

This is probably solved easily by pulling in a package like string-width and then replacing String(value).length with stringWidth(String(value)). Simple enough, I'll create a PR for that when I get a chance.

But a disclaimer that rendering text is really complicated and even terminals themselves get it wrong sometimes. Which is why things like Powerline 10k include steps to detect when ambiguous width characters are causing issues, so this probably won't be a universal fix. May be worth adding a 🤷 about that in the README once the fix is in to avoid false positives being reported again.