-
Notifications
You must be signed in to change notification settings - Fork 245
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
Using ⚙️ emoji in ProgressBar spinner message causes unnessecary line breaks #638
Comments
You probably just need to enable some of the Cargo features for proper Unicode support? |
Gave that a shot - same bug. Seems to happen regardless of if |
Well, maybe you can have a look at how |
@djc The issue seems to be related to unicode-rs/unicode-width#27 - the 0xfe0f unicode selector character turns the cog from a 1 character to a 2 character wide symbol, but it's not a universal width increase. Not really sure what to do here, but it seems like a difficult spot to be. Additionally, in the ratatui issue that links to it, the crate https://github.com/jameslanska/unicode-display-width/ is mentioned as a possible replacement. I haven't tested yet, but it'd need to be moved into the |
Why would it need to be moved into the console crate? I'd be okay with taking on the extra dependency on this (only if |
Could do, just feels weird to me to use the console crate for so few parts. But it'd just be a matter of replacing all occurrences of |
It's separation of concerns -- Unicode and dealing with the console are really separate domains so using different dependencies for these makes some amount of sense to me. |
Works for me then. I will try to find some time in the next couple days to whip up an MR. |
Actually hol up - while it is in theory separation of concerns, console-rs already has unicode width, which is why I flagged up maybe doing it in console anyway. We 100% sure we don't want to put it over in console-rs's own code? I feel like the fact that Cargo.toml has (Hi I'm still waking up, so I'm a bit slower to catch things like this :P) |
That's fair! Would be nice but console has had pretty slow maintenance recently. Okay, submit a PR to it and please ping me on it so I can have a look. |
-snip- I misread one of the internals - actually, my concerns are invalid. 2 PRs, coming up! |
I have created a pair of PRs that fully replace the API. Worth a note: there's a cast from a u64 to a usize in there, done to avoid changing APIs too much - also mentioned at https://github.com/console-rs/console/pull/210/files#r1552479044 |
Continuing the conversation from the PRs here because this is more meta to the whole change. Worth a note in the original unicode-width crate:
Given this info, I'm not really sure what we want to be doing here at this point. They suggest one solution involving probing the terminal for information on how it prints things using cursor widths etc, but this sounds like a far more involved and not entirely portable solution. I'm considering closing the PRs unless something better is thought of - I think the route I'm going down is just trading one evil for another, as neither option is actually portable. I want to see this fixed, but I'm no longer convinced the previous route is actually the correct one. |
Ah, that's fair. Maybe the right fix is to advocate that Dioxus uses the other gear? (On my Mac the gears in your OP look identical anyway -- in the browser, at least.) |
I'm closing the PRs, but leaving the issue open in case someone else wishes to pick up the mantle - I am short on time and consider the PRs unsuitable for fixing the issue, so I have to put this one aside. |
Is there any way to work around this other than just not using 2-char emojis? |
I don't think so, but am open to any ideas you have (after reading the discussion here, in #639 and in console-rs/console#210). |
|
@Jules-Bertholet that sounds great. @Silvea12 so can we close this now? |
Hey! I've been meaning to get to this, but I've fallen ill with COVID. I'll get back to you on it when I'm better. For me, a working thing is to install latest indicatif, and then running the above sample code and not seeing the extra newlines. That'll either result in this being closed, or a PR so it can be closed. I'll get to it once I'm feeling better! Sorry for the delay. |
Update: I can confirm a clean install works on my system, where I was experiencing the issue. Closing this, thanks @Jules-Bertholet for the update! |
Thanks for the confirmation, hope you feel better soon! |
For some reason, the width of ⚙️ (a 2-char emoji) seems to have its length mis-calculated, and as a result puts every single refresh on a new line.
As seen in the Dioxus CLI when watching a build. Reproduced in both Konsole 24.02.1 and JetBrains RustRover 2023.3 EAP on Linux with both the Fira Code and Hack fonts.
Note: this only happens with ⚙️, not with ⚙.
Minimal reproduction code:
The text was updated successfully, but these errors were encountered: