-
-
Notifications
You must be signed in to change notification settings - Fork 999
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
All renderables written to RichLog
seem to be rendered at min_width
width, even if I specifically request a width in the write
method.
I think width
should always be respected if passed as an argument to write
, and we only use the RichLog.min_width
fallback when no width has been explicitly requested by the developer.
Example:
rich_log = RichLog()
rich_log.write(Panel(...), width=20)
# the panel is rendered 78 characters wide, not 20.
An MRE as a snapshot test:
def test_richlog_write_at_specific_width(snap_compare):
"""Ensure we can write renderables at a specific width."""
class RichLogWriteAtSpecificWidth(App[None]):
CSS = "RichLog { width: 53; background: $accent;}"
def compose(self) -> ComposeResult:
yield RichLog(min_width=50)
async def run_before(pilot):
rich_log: RichLog = pilot.app.query_one(RichLog)
panel = Text("foo", style="black on red", justify="center")
rich_log.write(panel, width=20)
rich_log.write(panel, width=40)
rich_log.write(panel, width=60)
assert snap_compare(RichLogWriteAtSpecificWidth(), run_before=run_before)
Output:

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working