rich
rich copied to clipboard
[BUG] rich.progress should fallback to use ─ instead of -
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.
btw: is there any terminal that does not support the ━
character?
If triage accepts this then I can open a PR
This would would need to handle options.ascii_only
to default to hyphens.
@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?
Try options.is_terminal
Okay thanks
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
On Powershell with Windows Terminal
Before:
After:
If you want the default character to change to the thinner one then you can add ─
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.