Skip to content

Commit

Permalink
Merge branch 'main' into fix-scrollbar-fix-scrollbar-background-opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJGooding committed Jan 8, 2025
2 parents 152b6c2 + f5be1b7 commit 260069d
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed `Pilot.click` not working with `times` parameter https://github.com/Textualize/textual/pull/5398
- Fixed select refocusing itself too late https://github.com/Textualize/textual/pull/5420
- Fixed Log widget not refreshing on resize https://github.com/Textualize/textual/pull/5460
- Fixed special case with calculating the height of a container where all children have dynamic heights https://github.com/Textualize/textual/pull/5463
- Fixed scrollbars ignoring background opacity https://github.com/Textualize/textual/issues/5458


Expand Down
10 changes: 9 additions & 1 deletion src/textual/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,15 @@ def get_content_height(
Content height (in lines).
"""
if widget._nodes:
arrangement = widget._arrange(Size(width, 0))
if not widget.styles.is_docked and all(
child.styles.is_dynamic_height for child in widget.displayed_children
):
# An exception for containers with all dynamic height widgets
arrangement = widget._arrange(
Size(width, container.height - widget.gutter.height)
)
else:
arrangement = widget._arrange(Size(width, 0))
height = arrangement.total_region.bottom
else:
height = 0
Expand Down
4 changes: 3 additions & 1 deletion src/textual/layouts/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def arrange(
parent.pre_layout(self)
styles = parent.styles
row_scalars = styles.grid_rows or (
[Scalar.parse("1fr")] if size.height else [Scalar.parse("auto")]
[Scalar.parse("1fr")]
if (size.height and not parent.styles.is_auto_height)
else [Scalar.parse("auto")]
)
column_scalars = styles.grid_columns or [Scalar.parse("1fr")]
gutter_horizontal = styles.grid_gutter_horizontal
Expand Down
Loading

0 comments on commit 260069d

Please sign in to comment.