-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
If expand_all
is True
on a Pretty
renderable, the width of the renderable seems to still be calculated as if expand_all
was False
. Here is a minimal example:
from rich.pretty import Pretty
from rich.panel import Panel
from rich import print
print(Panel(Pretty(["alpha"], expand_all=True), expand=False))
print(Panel(Pretty(["alpha", "beta"], expand_all=True), expand=False))
print(Panel(Pretty(["alpha", "beta", "delta"], expand_all=True), expand=False))
print(Panel(Pretty(["alpha", "beta", "delta", "gamma"], expand_all=True), expand=False))
And here is the output:
╭───────────╮
│ [ │
│ 'alph │
│ a' │
│ ] │
╰───────────╯
╭───────────────────╮
│ [ │
│ 'alpha', │
│ 'beta' │
│ ] │
╰───────────────────╯
╭────────────────────────────╮
│ [ │
│ 'alpha', │
│ 'beta', │
│ 'delta' │
│ ] │
╰────────────────────────────╯
╭─────────────────────────────────────╮
│ [ │
│ 'alpha', │
│ 'beta', │
│ 'delta', │
│ 'gamma' │
│ ] │
╰─────────────────────────────────────╯
The Panel
is created with expand=False
so it fits the content, but clearly the width of the Pretty
output is incorrect because as you can see the panel does not really fit the output. In the first case the panel is too narrow, and as more elements are added it gets wider even though the actual rendered output is not getting wider.
Platform
Click to expand
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
Mac, Default Terminal
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working