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] Error in measuring width of multiline text of only whitespace #1133

Closed
castor-v-pollux opened this issue Mar 25, 2021 · 1 comment
Closed
Labels
accepted Task was accepted bug Something isn't working

Comments

@castor-v-pollux
Copy link

Describe the bug
When rendering a multiline Text made up of only spaces, Rich fails to measure its width. It seems that Rich will use the sum of each line's width rather than the maximum of them.

To Reproduce

from rich import print
from rich.panel import Panel
from rich.text import Text
print(Panel.fit(Text(' \n  \n   ', style = 'on green'), padding = 0))

Instead of rendering a panel of width 3, it turns out 6. As long as the Text contains non-whitespace characters, this phenomenon disappears.

Platform
I tried it on both windows 7/10 cmd and default terminal in linux, and encountered the same problem.

@willmcgugan willmcgugan added accepted Task was accepted bug Something isn't working and removed Needs triage labels Mar 25, 2021
@willmcgugan
Copy link
Collaborator

Please try v10.0.0

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

No branches or pull requests

2 participants