Skip to content

Commit

Permalink
fix selection list breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Dec 3, 2024
1 parent e196478 commit 74bbf1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/textual/widgets/_selection_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __init__(
disabled: The initial enabled/disabled state. Enabled by default.
"""
if isinstance(prompt, str):
prompt = Text.from_markup(prompt)
prompt = Text.from_markup(prompt, overflow="ellipsis")
prompt.no_wrap = True
super().__init__(prompt.split()[0], id, disabled)
self._value: SelectionType = value
"""The value associated with the selection."""
Expand Down
10 changes: 10 additions & 0 deletions tests/snapshot_tests/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2878,3 +2878,13 @@ def check_action(
return True

snap_compare(FooterApp())


def test_selection_list_wrap(snap_compare):
"""Regression test for https://github.com/Textualize/textual/issues/5326"""

class SelectionListApp(App):
def compose(self) -> ComposeResult:
yield SelectionList(("Hello World " * 100, 0))

snap_compare(SelectionListApp())

0 comments on commit 74bbf1a

Please sign in to comment.