Skip to content

Commit bb2214b

Browse files
authored
Merge pull request #5331 from Textualize/sel-list-fix
fix selection list breakage
2 parents 449b358 + 5bf6320 commit bb2214b

File tree

3 files changed

+167
-1
lines changed

3 files changed

+167
-1
lines changed

src/textual/widgets/_selection_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def __init__(
5050
disabled: The initial enabled/disabled state. Enabled by default.
5151
"""
5252
if isinstance(prompt, str):
53-
prompt = Text.from_markup(prompt)
53+
prompt = Text.from_markup(prompt, overflow="ellipsis")
54+
prompt.no_wrap = True
5455
super().__init__(prompt.split()[0], id, disabled)
5556
self._value: SelectionType = value
5657
"""The value associated with the selection."""
Lines changed: 155 additions & 0 deletions
Loading

tests/snapshot_tests/test_snapshots.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,3 +2878,13 @@ def check_action(
28782878
return True
28792879

28802880
snap_compare(FooterApp())
2881+
2882+
2883+
def test_selection_list_wrap(snap_compare):
2884+
"""Regression test for https://github.com/Textualize/textual/issues/5326"""
2885+
2886+
class SelectionListApp(App):
2887+
def compose(self) -> ComposeResult:
2888+
yield SelectionList(("Hello World " * 100, 0))
2889+
2890+
snap_compare(SelectionListApp())

0 commit comments

Comments
 (0)