Skip to content
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

[BUG] rich.progress should fallback to use ─ instead of - #1877

Closed
pcroland opened this issue Jan 28, 2022 · 8 comments
Closed

[BUG] rich.progress should fallback to use ─ instead of - #1877

pcroland opened this issue Jan 28, 2022 · 8 comments
Labels
accepted Task was accepted

Comments

@pcroland
Copy link

pcroland commented Jan 28, 2022

So I use wsltty mainly where rich.progress uses the ━━ character for the progress bar. I checked it in cmd.exe and it showed -- for the progress bar. The fallback should be ── (also used in tables), it would give a connected line.
img

btw: is there any terminal that does not support the character?

@pcroland pcroland changed the title [BUG] rich.progress should fallback to use ─ or ─ instead of -. [BUG] rich.progress should fallback to use ─ instead of -. Jan 28, 2022
@pcroland pcroland changed the title [BUG] rich.progress should fallback to use ─ instead of -. [BUG] rich.progress should fallback to use ─ instead of - Jan 28, 2022
@wasi-master
Copy link
Contributor

wasi-master commented Feb 9, 2022

If triage accepts this then I can open a PR

@willmcgugan
Copy link
Collaborator

This would would need to handle options.ascii_only to default to hyphens.

@willmcgugan willmcgugan added accepted Task was accepted and removed Needs triage labels Feb 11, 2022
@wasi-master
Copy link
Contributor

@willmcgugan If you don't mind, I just need a way to detect if the current terminal if command prompt or not

I found the line where the bar is set and was thinking about some logic like this:

bar = "-" if ascii else ("─" if USING_COMMAND_PROMPT else "━")

Now the only problem is I don't know how to detect if command prompt is being used. Or do you suggest any alternatives?

@willmcgugan
Copy link
Collaborator

Try options.is_terminal

@wasi-master
Copy link
Contributor

Okay thanks

@wasi-master
Copy link
Contributor

wasi-master commented Feb 18, 2022

So the change I mentioned above works, but it has one unexpected side effect. basically options.is_terminal is for checking if the output is a terminal, not specifically command prompt, and because of that the normal behavior also changes. now one thing I notice is that it defaults to ASCII Mode on Command prompt.

So I went on to test if ASCII mode is necessary. and it looks like it isn't since the normal character also works for me, so I checked a bunch of encodings and most of them seem to work fine. now I am a bit stuck on what to do next

image

On Powershell with Windows Terminal

Before:
image
After:
image

If you want the default character to change to the thinner one then you can add

@pcroland
Copy link
Author

pcroland commented Sep 8, 2022

This is still an issue as of now. The fallback character can simply be a . It's even available in CP437 IBM so every terminal supports it in theory.

Copy link

github-actions bot commented Jul 2, 2024

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Task was accepted
Projects
None yet
Development

No branches or pull requests

3 participants