indicatif: Using ⚙️ emoji in ProgressBar spinner message causes unnessecary line breaks
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:
[dependencies]
indicatif = "0.17.8"
use std::time::Duration;
use indicatif::ProgressBar;
fn main() {
let mut bar = ProgressBar::new_spinner();
bar.enable_steady_tick(Duration::from_millis(200));
bar.set_message("⚙️ Hi there!");
std::thread::sleep(Duration::from_secs(5));
}
About this issue
- Original URL
- State: open
- Created 3 months ago
- Comments: 20
unicode-width
1.12 (released today) now supports U+FE0F 2-char emojis, including ⚙️ (skin tone modifiers and ZWJ emojis remain unsupported).I don’t think so, but am open to any ideas you have (after reading the discussion here, in #639 and in https://github.com/console-rs/console/pull/210).
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.
Works for me then. I will try to find some time in the next couple days to whip up an MR.
@djc The issue seems to be related to https://github.com/unicode-rs/unicode-width/issues/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
console
crate instead.