-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] multibyte characters in Progressbar TextColumn mess up render #3254
Comments
Seems, to be an issue with Kitty terminal on macOS. iTerm2 works fine. Also, |
I hope we solved your problem. If you like using Rich, you might also enjoy Textual |
But with given Progressbar, how could I avoid the problem? I would make the whole progress shorter by some bytes, but that |
There is no way for Rich to know how wide some characters will render on any given terminal. This mostly effects emoji. There's no real solution to this, other than avoid the characters that are problematic. |
@willmcgugan but I know I will be inserting 2-byte character there. how can I tell whole progressbar to be 1 byte (or, say 6 bytes to be sure) shorter? btw, there's some wcwidth project, it doesn't help? |
The number of bytes in a codepoint has little to do with the width it will be rendered as. That is defined by the Unicode database, but different terminals use different versions of that database. We use the same data as wcwidth. |
so. the question again. can I make the progressbar not so wide as whole terminal: progress = Progress(
TextColumn("{task.fields[play_state]} [bold blue]{task.description}", justify="left"),
BarColumn(bar_width=None),
"[progress.percentage]{task.percentage:>3.1f}%",
"•",
TimeRemainingColumn(),
console=console,
) where do I put |
Solved with Panel and Live: Panel accepts width parameter, Live is needed to keep it rendered. Seems Progress internally uses Live, so didn't use Live before. |
I hope we solved your problem. If you like using Rich, you might also enjoy Textual |
@willmcgugan do you have an answer to my question:
and have you checked my implementation? comments on that? |
Describe the bug
So, I have a Progressbar:
and I put
play_state
an unicode character, for example "⏸️" (2 bytes), it messes up display:also, if I put that character literally to TextColumn, display is still messed up:
but progressbar is okay if I put some other character there "▶" (1 byte)
more complete
Progress
creation:Platform
Click to expand
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
I may ask you to copy and paste the output of the following commands. It may save some time if you do it now.
If you're using Rich in a terminal:
The text was updated successfully, but these errors were encountered: