Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji in default output causes width calculation to be incorrect #71

Closed
nbigaouette opened this issue Sep 23, 2020 · 5 comments
Closed
Labels
bug Something isn't working time sink You may lose your mind if you try to fix this, but I won't stop you

Comments

@nbigaouette
Copy link

nbigaouette commented Sep 23, 2020

One of my step has two emojis in its name (🦀). This seems to break the terminal width calculation used to send the file/number on the right side. See how the column number (9) gets sent to a new line in the screenshot:

Screen Shot 2020-09-23 at 11 18 03 AM

I suspect it could be caused by bad calculation of the emoji's UTF-8 width. Interestingly, the problem does not happen if I have one emoji in the name. Weird... 🤔

EDIT: This is on macOS Catalina 10.15.6 using iTerm2 3.3.12 and tmux.

@bbqsrc
Copy link
Member

bbqsrc commented Sep 23, 2020

Terminals all render emoji widths differently, so this isn't something I intend to mitigate personally. It's a known issue with how monospaced fonts, terminal renderers and Unicode interact.

Happy to leave this open if someone wants to try to tackle this, but forewarning that it's an endless pit of despair and nothing good comes of it. tl;dr computers mean we can't have nice things. haha

@bbqsrc bbqsrc changed the title Potential bad terminal width calculation? Emoji in default output causes width calculation to be incorrect Sep 23, 2020
@bbqsrc bbqsrc added bug Something isn't working time sink You may lose your mind if you try to fix this, but I won't stop you labels Sep 23, 2020
@nbigaouette
Copy link
Author

😂
👍

@bbqsrc
Copy link
Member

bbqsrc commented Oct 1, 2020

Hum, this may not be the time sink I expect. There's a crate: https://github.com/unicode-rs/unicode-width

We could just use this. It won't fix everything I suspect, but it'll work in more cases than we currently handle. Slap this everywhere I currently did a width calculation and we'll have a better life.

@bbqsrc bbqsrc added good first issue Good for newcomers help wanted Extra attention is needed and removed time sink You may lose your mind if you try to fix this, but I won't stop you labels Oct 1, 2020
@bbqsrc
Copy link
Member

bbqsrc commented Oct 1, 2020

Definitely read unicode-rs/unicode-width#4 if you're going to tackle this, though. Maybe I removed time sink too soon, I'll put it back, ahaha

@bbqsrc bbqsrc added time sink You may lose your mind if you try to fix this, but I won't stop you and removed good first issue Good for newcomers labels Oct 1, 2020
@tyranron tyranron removed the help wanted Extra attention is needed label Sep 27, 2021
@tyranron
Copy link
Member

Fixed in #128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working time sink You may lose your mind if you try to fix this, but I won't stop you
Projects
None yet
Development

No branches or pull requests

3 participants