Skip to content

Commit

Permalink
Merge pull request #5331 from Textualize/sel-list-fix
Browse files Browse the repository at this point in the history
fix selection list breakage
  • Loading branch information
willmcgugan authored Dec 3, 2024
2 parents 449b358 + 5bf6320 commit bb2214b
Show file tree
Hide file tree
Showing 3 changed files with 167 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
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())

0 comments on commit bb2214b

Please sign in to comment.