diff --git a/sandbox/will/center2.py b/sandbox/will/center2.py index e4d78ac25..1711fd09a 100644 --- a/sandbox/will/center2.py +++ b/sandbox/will/center2.py @@ -27,6 +27,10 @@ class CenterApp(App): margin: 2 4; } + #sidebar.hidden { + width: 0; + } + Static { background: $panel; color: $text-panel; @@ -35,6 +39,9 @@ class CenterApp(App): """ + def on_mount(self) -> None: + self.bind("t", "toggle_class('#sidebar', 'hidden')") + def compose(self): yield Static("Sidebar", id="sidebar") yield Vertical( @@ -45,4 +52,4 @@ class CenterApp(App): ) -app = CenterApp() +app = CenterApp(log_verbosity=3) diff --git a/src/textual/_compositor.py b/src/textual/_compositor.py index 72b309d89..1de9e67f3 100644 --- a/src/textual/_compositor.py +++ b/src/textual/_compositor.py @@ -632,6 +632,7 @@ class Compositor: update_regions: set[Region] = set() else: update_regions = self._dirty_regions.copy() + if screen_region in update_regions: # If one of the updates is the entire screen, then we only need one update full = True diff --git a/src/textual/box_model.py b/src/textual/box_model.py index 3d7a9a6cd..e05ace9e3 100644 --- a/src/textual/box_model.py +++ b/src/textual/box_model.py @@ -81,7 +81,7 @@ def get_box_model( ) content_width = min(content_width, max_width) - content_width = max(Fraction(1), content_width) + content_width = max(Fraction(0), content_width) if styles.height is None: # No height specified, fill the available space diff --git a/src/textual/screen.py b/src/textual/screen.py index 2af611482..c4773b76e 100644 --- a/src/textual/screen.py +++ b/src/textual/screen.py @@ -170,7 +170,6 @@ class Screen(Widget): self.update_timer.pause() try: hidden, shown, resized = self._compositor.reflow(self, size) - Hide = events.Hide Show = events.Show for widget in hidden: diff --git a/src/textual/widget.py b/src/textual/widget.py index 69886f6ab..558733c8d 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -1040,7 +1040,9 @@ class Widget(DOMNode): if layout: self._layout_required = True - self._clear_arrangement_cache() + if isinstance(self._parent, Widget): + self._parent._clear_arrangement_cache() + if repaint: self._set_dirty(*regions) self._content_width_cache = (None, 0)