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

RichLog shrink is shrinking renderable to min_width rather than the available width #4980

Closed
darrenburns opened this issue Sep 10, 2024 · 1 comment · Fixed by #4978
Closed
Assignees
Labels
bug Something isn't working

Comments

@darrenburns
Copy link
Member

When shrink=True, RichLog incorrectly shrinks the renderable down to RichLog.min_width. This is not what you'd expect and it doesn't align with the docstring.

Given the following snapshot test:

def test_richlog_shrink(snap_compare):
    class RichLogShrink(App[None]):
        CSS = "RichLog { width: 20; background: red;}"

        def compose(self) -> ComposeResult:
            rich_log = RichLog(min_width=4)
            panel = Panel("lorem ipsum dolor sit amet lorem ipsum dolor sit amet")
            rich_log.write(panel)  # shrink=True by default
            yield rich_log

    assert snap_compare(RichLogShrink(), terminal_size=(24, 6))

This outputs:

image

The Panel has shrunk down to width 4, rather than the available width.

@darrenburns darrenburns added the bug Something isn't working label Sep 10, 2024
@darrenburns darrenburns self-assigned this Sep 10, 2024
@darrenburns darrenburns mentioned this issue Sep 10, 2024
3 tasks
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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

Successfully merging a pull request may close this issue.

1 participant