Skip to content

Commit

Permalink
faster
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 24, 2024
1 parent 6a75cc7 commit 476c16a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/textual/widgets/_option_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,12 @@ def get_content_width(self, container: Size, viewport: Size) -> int:
options = console.options
padding = self.get_component_styles("option-list--option").padding
padding_width = padding.width
return max(
Measurement.get(console, options, option.prompt).maximum + padding_width
for option in self._options
return (
max(
Measurement.get(console, options, option.prompt).maximum
for option in self._options
)
+ padding_width
)

def get_content_height(self, container: Size, viewport: Size, width: int) -> int:
Expand Down

0 comments on commit 476c16a

Please sign in to comment.