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

[BUG] Height parameter in Layout is not used #2518

Closed
ronf opened this issue Sep 10, 2022 · 3 comments · Fixed by #2540
Closed

[BUG] Height parameter in Layout is not used #2518

ronf opened this issue Sep 10, 2022 · 3 comments · Fixed by #2540

Comments

@ronf
Copy link

ronf commented Sep 10, 2022

Describe the bug

The Layout class takes an argument of "height", but it if I'm reading the code right it never seem to get used. The value is saved in the constructor, but later, when rendering, the height is set as follows:

render_height = options.height or console.height

Also, while "height" is listed in the docs for Layout(), it has a blank description. Perhaps this was removed before but a few remnants of it remained?

Platform

This should apply to all platforms -- I found this by code inspection. I'm running rich 12.5.1 on Python 3.10.6 on macOS Monterey (12.5).

The workaround seems to be to create a "console" object with the desired height, and then call print() of the Layout on that console rather than using rich.print().

To avoid confusion, I'm thinking maybe this parameter should just be removed. Alternately, I could see it making sense to provide a max_height which could shrink the height to less than the console (or whatever container it is contained in), but I'm not sure it ever makes sense to grow it to larger than console.height or options.height. I could see also offering a max_width that worked along the same lines, where render_width could be set to the smaller of that and options.max_width.

@willmcgugan
Copy link
Collaborator

Perhaps this was removed before but a few remnants of it remained?

Suspect that is the case.

@darrenburns darrenburns linked a pull request Sep 23, 2022 that will close this issue
9 tasks
@github-actions
Copy link

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

@ronf
Copy link
Author

ronf commented Sep 24, 2022

Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants