-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix progress bar in windows #4317
Conversation
I don't think this is a fix. I wonder if |
Okay, the reason is Consolas not supporting our bar characters properly I think because they are 2-byte unicode characters. |
@BYK, You are right actually. I found this issue that tells us more info: microsoft/WSL#1907 In short, we don't know the char width. So in Windows, make the bar half would help. |
That would make the experience worse for people like me so I'm not a fan of this idea. May be we can introduce a way to override these characters and default to Also, I'm curious if simply setting the |
Nope. It still affected by font in all of my testing.
Hmm, not a bad idea. May be we could introduce a way to override |
😿
Why would that be useful? For this issue, it is not that columns being reported incorrectly but the progress bar characters taking up more space than they should be, right? |
"fastidious", haha! I like the color bar. After some thoughts, I think it should be optional for "ambiguous width characters" cause it affected by fonts. And default to 2 in Windows., other platforms would be 1. |
May be we can tie this to emoji support detection? |
@BYK, I do not fully understand your mean. And I think a separate arg will be better. Here's one of report that it will also happen in MacOS: #2530 (comment) During researching, I found that this is a pretty common problem: Vim / MacOS Terminal / iTerm also provide this option: I could send a PR if you think it's the right direction. Thanks! |
Let's just mimic what Jest does here: https://github.com/facebook/jest/pull/3626/files Which is using the same block character with different color codes. |
Sorry @BYK, I linked a bad ref in another issue. I tried it and no helps. I also performed some tests to see if Jest does any other fixes and apparently they have the same problem. But Jest (and NPM) does a simple trick and use a shorter length instead. https://github.com/npm/npmlog/blob/master/log.js#L45 |
Ah, so the answer lies in either limiting the width or simply not using unicode characters. I think limiting the length is not the safest bet since terminal widths can go even lower and then you have the same issue again. I think we can just do what Something like:
What do you think? |
Replace block character with '#' and '-'.
Looks like you need to run This new one looks pretty okay to me. @arcanis @bestander what do you guys think? |
look fine to me, no onbjections |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go!
EDIT: It's only an issue when my Profile has Advanced > Declare Terminal As set to "rxvt." Can't recall why I set it to that but changing it to "xterm-256color" resolves this. Unfortunately this is still an issue for me in Terminal.app using the Hack font at various sizes. Here's how it looks:
|
@swrobel This time really looks like another Yarn bug because the NodeJS console test in #4317 (comment) works well with rxvt. |
@swrobel You could get it work with |
This is beyond me so I'll leave it to @KayLeung |
…kg#4317) **Summary** Fixes yarnpkg#2530. This patch replaces the 2-byte progress bar characters with `-` and `#` wrapped in a pair of `[` and `]` symbols to make it looks like a progress bar on the console with "simple", one-byte characters. The reason for preferring one-byte characters is the inconsistent width calculation on certain terminal emulators causing the calculated progress bar width to overflow the available terminal width, causing the progress bar to split into multiple lines. It now looks like this: ![new progress bar chars](https://i.imgur.com/d8XA4yS.gif) **Test plan** Manual verification and updating of existing test snapshots.
Summary
Fixes #2530. This patch replaces the 2-byte progress bar characters with
-
and#
wrapped in a pair of[
and]
symbols to make it looks like a progress bar on the console with "simple", one-byte characters.The reason for preferring one-byte characters is the inconsistent width calculation on certain terminal emulators causing the calculated progress bar width to overflow the available terminal width, causing the progress bar to split into multiple lines.
It now looks like this:
Test plan
Manual verification and updating of existing test snapshots.