Skip to content

RichLog.write(expand=True) not working with latest Rich #6337

@TomJGooding

Description

@TomJGooding

I haven't checked what else might have changed, but after updating to the latest Rich (14.3.0) released earlier today, I found that RichLog.write with expand=True isn't working as expected.

Here's a simple example with before and after screenshots for comparison:

rich 14.2.0 rich 14.3.0
rich 14.2.0 rich 14.3.0
from importlib.metadata import version

from rich.text import Text
from textual.app import App, ComposeResult
from textual.widgets import RichLog


class ExampleApp(App):
    def compose(self) -> ComposeResult:
        yield RichLog(min_width=20)

    def on_mount(self) -> None:
        log = self.query_one(RichLog)
        log.write(
            Text(f"rich {version('rich')}", style="on red", justify="right"),
            expand=True,
        )


if __name__ == "__main__":
    app = ExampleApp()
    app.run()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions