Skip to content

Commit 07bb4af

Browse files
authored
Merge pull request #4617 from Textualize/heigh-zero
zero height renderables
2 parents c2eff2d + abafa66 commit 07bb4af

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## Unreleased
9+
10+
### Changed
11+
12+
- `get_content_height` will now return 0 if the renderable is Falsey https://github.com/Textualize/textual/pull/4617
13+
814
## [0.65.2] - 2023-06-06
915

1016
### Fixed

examples/code_browser.tcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ CodeBrowser.-show-tree #tree-view {
2323
#code-view {
2424
overflow: auto scroll;
2525
min-width: 100%;
26+
hatch: right $primary;
2627
}
2728
#code {
2829
width: auto;

src/textual/timer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ async def stop_timer(timer: Timer) -> None:
118118
if timer._task is not None:
119119
timer._active.set()
120120
timer._task.cancel()
121-
await timer._task
121+
try:
122+
await timer._task
123+
except CancelledError:
124+
pass
122125

123126
await gather(*[stop_timer(timer) for timer in list(timers)])
124127

src/textual/widget.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,13 +1345,17 @@ def get_content_height(self, container: Size, viewport: Size, width: int) -> int
13451345

13461346
renderable = self.render()
13471347
if isinstance(renderable, Text):
1348-
height = len(
1349-
renderable.wrap(
1350-
self._console,
1351-
width,
1352-
no_wrap=renderable.no_wrap,
1353-
tab_size=renderable.tab_size or 8,
1348+
height = (
1349+
len(
1350+
renderable.wrap(
1351+
self._console,
1352+
width,
1353+
no_wrap=renderable.no_wrap,
1354+
tab_size=renderable.tab_size or 8,
1355+
)
13541356
)
1357+
if renderable
1358+
else 0
13551359
)
13561360
else:
13571361
options = self._console.options.update_width(width).update(

src/textual/widgets/_label.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ class Label(Static):
1010
Label {
1111
width: auto;
1212
height: auto;
13+
min-height: 1;
1314
}
1415
"""

0 commit comments

Comments
 (0)