mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix bug with layout updates
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user