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 (?): refresh and max-height #1402

Closed
willmcgugan opened this issue Dec 19, 2022 Discussed in #1384 · 2 comments · Fixed by #1403
Closed

BUG (?): refresh and max-height #1402

willmcgugan opened this issue Dec 19, 2022 Discussed in #1384 · 2 comments · Fixed by #1403

Comments

@willmcgugan
Copy link
Collaborator

Discussed in #1384

Originally posted by nitzan-shaked December 17, 2022
(first of all: I'm happy to attach screenshots, videos, minimal code to repro, etc. -- just not sure how this community works. Apologies in advance!)

It looks like the following misbehaves:
a Static with height: auto,
nested in a Vertical with height: auto,
itself nested in a Vertical with height: auto; max-height: 10

Specifically: set the context of the Static to something long (say 20 lines of text), which displays nicely and adds a scrollbar as expected. Then, set the content of the Static to "Hello" -- it works, but everything remains "too tall". A simple refresh (just resize the terminal a bit) solves this.

Given that a simple terminal resize "fixes" this I am assuming that's not intended behavior.

Specifically, changing the code of Widget._clear_arrangement_cache to:

    def _clear_arrangement_cache(self) -> None:
        """Clear arrangement cache, forcing a new arrange operation."""
        self._arrangement = None
        # THE BELOW IS NEW
        if isinstance(self._parent, Widget):
            self._parent._clear_arrangement_cache()

Seems to solve, but honestly I'm not sure that's the right solution. If I'm anywhere in the right direction then there should be a "force_layout" method which will do this, and set ._layout_required, and probably do something with Screen (post a message? Set its layout_required? Donno.)

So, questions:

  1. Am I missing the obvious? If so -- what is it?
  2. And while I'm here -- are you interested in PR contribs? Eg fixing this; or -- stuff for TreeControl which I've added; or for DataTable.
  3. If so -- how? Where's the guide you'd like me to follow? (tests, conventions, ci, ...)

Cheers!

@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@github-actions
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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant