Skip to content

Commit e965553

Browse files
committed
changelog
1 parent fadefaf commit e965553

File tree

6 files changed

+110
-74
lines changed

6 files changed

+110
-74
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Fixed
1111

1212
- Fixed markup escaping edge cases https://github.com/Textualize/textual/pull/5697
13+
- Fixed incorrect auto height in Collapsible https://github.com/Textualize/textual/pull/5703
1314

1415
### Changed
1516

src/textual/css/styles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ def rich_style(self) -> Style:
13471347

13481348
@property
13491349
def gutter(self) -> Spacing:
1350-
"""Get space around widget.
1350+
"""Get space around widget (padding + border)
13511351
13521352
Returns:
13531353
Space around widget content.

src/textual/widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ def _get_box_model(
15191519
content_width = Fraction(_content_width)
15201520
content_height = Fraction(_content_height)
15211521
is_border_box = styles.box_sizing == "border-box"
1522-
gutter = styles.gutter
1522+
gutter = styles.gutter # Padding plus border
15231523
margin = styles.margin
15241524

15251525
is_auto_width = styles.width and styles.width.is_auto
@@ -1633,12 +1633,12 @@ def _get_box_model(
16331633
max_height = styles.max_height.resolve(
16341634
container - margin.totals, viewport, height_fraction
16351635
)
1636+
16361637
if is_border_box:
16371638
max_height -= gutter.height
16381639
content_height = min(content_height, max_height)
16391640

16401641
content_height = max(Fraction(0), content_height)
1641-
16421642
model = BoxModel(
16431643
content_width + gutter.width, content_height + gutter.height, margin
16441644
)

src/textual/widgets/_collapsible.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CollapsibleTitle(Static, can_focus=True):
2222
CollapsibleTitle {
2323
width: auto;
2424
height: auto;
25-
padding: 0 1 0 1;
25+
padding: 0 1;
2626
text-style: $block-cursor-blurred-text-style;
2727
color: $block-cursor-blurred-foreground;
2828
@@ -227,7 +227,8 @@ def _on_mount(self, event: events.Mount) -> None:
227227

228228
def compose(self) -> ComposeResult:
229229
yield self._title
230-
yield self.Contents(*self._contents_list)
230+
with self.Contents():
231+
yield from self._contents_list
231232

232233
def compose_add_child(self, widget: Widget) -> None:
233234
"""When using the context manager compose syntax, we want to attach nodes to the contents.

0 commit comments

Comments
 (0)