We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a073be8 commit 6dabbcaCopy full SHA for 6dabbca
src/textual/widgets/_button.py
@@ -206,7 +206,11 @@ def __init__(
206
"""Amount of time in seconds the button 'press' animation lasts."""
207
208
def get_content_width(self, container: Size, viewport: Size) -> int:
209
- return cell_len(str(self.label)) + 2
+ try:
210
+ return max([cell_len(line) for line in self.label.plain.splitlines()]) + 2
211
+ except ValueError:
212
+ # Empty string label
213
+ return 2
214
215
def __rich_repr__(self) -> rich.repr.Result:
216
yield from super().__rich_repr__()
0 commit comments