-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Progress bar width calculation does not recognize double-width characters #12014
Comments
Can we not just use |
|
If you have a string, you probably want this instead: |
@Mic92 This seems to be trickier than calling
I tried different locales, but Some East-Asian characters do not seem to have a well defined width either. It will be difficult to support this correctly, unless the cursor position is queried from the terminal after printing a line. If https://github.com/ridiculousfish/widecharwidth/blob/master/widechar_width_c.h would be used, then for ambitious cases a character width of The question is whether it makes sense to introduce this library as build time dependency of Nix. |
We like to preserve the ability to bootstrap a Nix from source in a non-Nix environment where dependencies are more expensive, especially in terms of human overhead. The other use case that suffers a bit more is packaging into other distros, where users may not use Nix to get a better Nix. We'd be putting more responsibility on those distro packagers, but it's actually no worse than the status quo in this case. |
Many Linux distribution don't allow vendoring of dependencies as a policy btw. So we should make it easy in meson to override vendored dependencies. Our libgit2 patches also caused some headaches. |
Describe the bug
When the progress bar is rendered wider than expected, an unexpected line break occurs, causing scrolling, and a failure to clear the bar whose content is on the second to last line for the most part.
unicode.nix
Note
-L
was not passed, so it is not expected for log lines to remain on screen, and indeed theok
line did not.Steps To Reproduce
🔍
to the log and sleeps to make sure the line makes it into the progress bar.Expected behavior
Double-width unicode characters count double when deciding where to cut off the progress bar content.
In Rust, I would use
unicode_width
. I am not aware of a C/C++ alternative.Assuming this logic will come from a dependency, we'll want to make it optional, in order to keep the compile-from-scratch footprint small.
I personally wouldn't mind introducing optional Rust code into the project, but that would have to be a team decision.
Metadata
Additional context
This affects non-western users and users of tools with fancy logging.
Loosely related:
Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: