Skip to content

Commit

Permalink
Merge pull request #4844 from Textualize/auto-grow
Browse files Browse the repository at this point in the history
grow height for scrollbar
  • Loading branch information
willmcgugan authored Aug 5, 2024
2 parents 5472c18 + 2fc524a commit f4cfbc8
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 96 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Input cursor will no longer jump to the end on focus https://github.com/Textualize/textual/pull/4773
- Removed `Size.cip_size`, which was a clone of `crop_size`
- Widgets with auto dimensions will now grow if there is a scrollbar https://github.com/Textualize/textual/pull/4844

### Fixed

Expand Down
8 changes: 6 additions & 2 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,9 @@ def _get_box_model(
content_width = Fraction(
self.get_content_width(content_container - margin.totals, viewport)
)
if styles.scrollbar_gutter == "stable" and styles.overflow_x == "auto":
if (
styles.overflow_x == "auto" and styles.scrollbar_gutter == "stable"
) or self.show_vertical_scrollbar:
content_width += styles.scrollbar_size_vertical
if (
content_width < content_container.width
Expand Down Expand Up @@ -1286,7 +1288,9 @@ def _get_box_model(
content_height = Fraction(
self.get_content_height(content_container, viewport, int(content_width))
)
if styles.scrollbar_gutter == "stable" and styles.overflow_y == "auto":
if (
styles.overflow_y == "auto" and styles.scrollbar_gutter == "stable"
) or self.show_horizontal_scrollbar:
content_height += styles.scrollbar_size_horizontal
if (
content_height < content_container.height
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f4cfbc8

Please sign in to comment.