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

Fix for layout issue with Textual 0.54 #78

Merged
merged 4 commits into from
Mar 27, 2024
Merged

Fix for layout issue with Textual 0.54 #78

merged 4 commits into from
Mar 27, 2024

Conversation

davep
Copy link
Contributor

@davep davep commented Mar 27, 2024

By the looks of things, with #77, the issue is that there is a Vertical that is width auto, which contains a Tree that is width auto, and a Label that is width 100%. The intention seems to be that the sidebar should be as wide as the tree is, and the tree should be as wide as its content needs; meanwhile the label should be the full width of its container.

At some point recently it seems the balance in this setup has changed and the 100% label is making its auto-width container extra greedy.

Given that there's no simple way of saying "be 100% of my parent but don't put pressure on its width calculation if it's width auto"1 this PR changes things so that the label itself is also width auto, and tries to ensure that the background looks like it did before.

The fundamental fix for this probably needs to be in Textual's layout code, but this will fix Trogon itself in the meanwhile.

Fixes #77.

Footnotes

  1. This smells like a similar class of problem to that which we ran into with Dialog.

By the looks of things, with #77, the issue is that there is a Vertical that
is width auto, which contains a Tree that is width auto, and a label that is
width 100%. The intention seems to be that the sidebar should be as wide as
the tree is, and the tree should be as wide as its content needs; meanwhile
the label should be the full width of its container.

At some point recently it seems the balance in this setup has changed and
the 100% label is making its auto-width container extra greedy.

Given that there's no simple way of saying "be 100% of my parent but don't
put pressure on its width calculation if it's width auto" this commit
changes things so that the label itself is also width auto, and tries to
ensure that the background looks like it did before.

The fundamental fix for this probably needs to be in Textual's layout code,
but this will fix Trogon itself in the meanwhile.

Fixes #77.
@davep davep added the bug Something isn't working label Mar 27, 2024
@davep davep self-assigned this Mar 27, 2024
@davep davep merged commit 083e95c into main Mar 27, 2024
15 checks passed
@davep davep deleted the fix-for-new-textual branch March 27, 2024 14:04
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 this pull request may close these issues.

Trogon doesn't work with Textual 0.54.0
2 participants