From 3c0078ffed4a7e742d30b07518bac4b1ea462cdd Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 30 Nov 2024 14:14:12 +0000 Subject: [PATCH] Refresh auto dimensions --- src/textual/widgets/_option_list.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/textual/widgets/_option_list.py b/src/textual/widgets/_option_list.py index 2863f60aa7..9a0e0b66f6 100644 --- a/src/textual/widgets/_option_list.py +++ b/src/textual/widgets/_option_list.py @@ -362,6 +362,7 @@ def _add_lines( self._lines.append(OptionLineSpan(-1, 0)) self.virtual_size = Size(width, len(self._lines)) + self.refresh(layout=self.styles.auto_dimensions) def _populate(self) -> None: """Populate the lines data-structure.""" @@ -374,7 +375,6 @@ def _populate(self) -> None: self._contents, self.scrollable_content_region.width - self._left_gutter_width(), ) - self.refresh(layout=True) def get_content_width(self, container: Size, viewport: Size) -> int: """Get maximum width of options.""" @@ -952,7 +952,6 @@ def _page(self, direction: Direction) -> None: # If we find ourselves in a position where we don't know where we're # going, we need a fallback location. Where we go will depend on the # direction. - self._populate() assert self._spans is not None assert self._lines is not None