Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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())
Loading