Open MarijnS95 opened 11 months ago
Note that in both the example and our own code ansi-parsing
and unicode-width
are turned on on the console
crate.
EDIT: Neither is this solved by enabling improved_unicode
.
I'm open to reviewing a fix for this, but probably won't be able to do much other work on this. I suppose the style::measure()
function might be implicated? Not sure which part is going wrong here, I think (particularly with those Cargo features) we should have code for handling this kind of thing.
Yeah:
#[test]
fn measure_emojis() {
assert_eq!(measure("🖼️"), 2);
assert_eq!(measure("🧼"), 2);
}
Fails with measure()
returning 1
. I'm not sure if this is also something that changes with fonts and the renderer, as shown with Windows Terminal padding the emoji to two characters while VSCode does not. I.e. printing:
println!("abcdef");
println!("🖼️ 🧼"); // Only 2 spaces here
Gives in VSCode terminal: But in Microsoft Terminal:
Even Windows Console Host adds a third space, despite not being able to render the emoji:
Consider the example in report #144, modified to use
🖼️
emoji which takes up 2 characters in Windows terminals, and modified to usewide_bar
to fill the entire screen:As can be seen in the screenshots the
)
in Microsoft Terminal and thes)
in VScode wrap around to the next line, spamming progress bars.Note that in the VSCode terminal there appears to be no space between
🖼️
andDownloading
, which is similar to what I observe on Linux (alacritty
terminal): the emoji always takes up a single character even if it is rendered in two characters. Not having a space at all (e.g.🖼️Downloading
) gets theD
rendered inside the picture frame emoji:(I'm not familiar with the right ways to solve this in a platform-agnostic manner)
Looking at the organization structure here, perhaps this issue should be transferred to:
https://github.com/console-rs/console
Note that the leading space in the screenshot is simply caused by the unused
{prefix}
that I forgot to remove while transferring our progress bars to a minimal example.