You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
deftest_richlog_write_at_specific_width(snap_compare):
"""Ensure we can write renderables at a specific width."""classRichLogWriteAtSpecificWidth(App[None]):
CSS="RichLog { width: 53; background: $accent;}"defcompose(self) ->ComposeResult:
yieldRichLog(min_width=50)
asyncdefrun_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)
assertsnap_compare(RichLogWriteAtSpecificWidth(), run_before=run_before)
Output:
The text was updated successfully, but these errors were encountered:
All renderables written to
RichLog
seem to be rendered atmin_width
width, even if I specifically request a width in thewrite
method.I think
width
should always be respected if passed as an argument towrite
, and we only use theRichLog.min_width
fallback when no width has been explicitly requested by the developer.Example:
An MRE as a snapshot test:
Output:
The text was updated successfully, but these errors were encountered: