zero height renderables

This commit is contained in:
Will McGugan
2024-06-06 20:03:39 +01:00
parent c2eff2d9c5
commit f72fb5d11f
5 changed files with 22 additions and 7 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
### Changed
- `get_content_height` will now return 0 if the renderable is Falsey
## [0.65.2] - 2023-06-06
### Fixed

View File

@@ -23,6 +23,7 @@ CodeBrowser.-show-tree #tree-view {
#code-view {
overflow: auto scroll;
min-width: 100%;
hatch: right $primary;
}
#code {
width: auto;

View File

@@ -118,7 +118,10 @@ class Timer:
if timer._task is not None:
timer._active.set()
timer._task.cancel()
await timer._task
try:
await timer._task
except CancelledError:
pass
await gather(*[stop_timer(timer) for timer in list(timers)])

View File

@@ -1345,13 +1345,17 @@ class Widget(DOMNode):
renderable = self.render()
if isinstance(renderable, Text):
height = len(
renderable.wrap(
self._console,
width,
no_wrap=renderable.no_wrap,
tab_size=renderable.tab_size or 8,
height = (
len(
renderable.wrap(
self._console,
width,
no_wrap=renderable.no_wrap,
tab_size=renderable.tab_size or 8,
)
)
if renderable
else 0
)
else:
options = self._console.options.update_width(width).update(

View File

@@ -10,5 +10,6 @@ class Label(Static):
Label {
width: auto;
height: auto;
min-height: 1;
}
"""