From ff404e2bbfcabc7f15fe1459417730bcd215a53d Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 23 May 2023 10:35:48 +0100 Subject: [PATCH] Only refresh on deselect if something was deselected --- src/textual/widgets/_selection_list.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/textual/widgets/_selection_list.py b/src/textual/widgets/_selection_list.py index 8e3ba4688..17852b6dc 100644 --- a/src/textual/widgets/_selection_list.py +++ b/src/textual/widgets/_selection_list.py @@ -302,12 +302,12 @@ class SelectionList(Generic[SelectionType], OptionList): Args: selection: The selection to mark as selected. """ - self._deselect( + if self._deselect( selection.value if isinstance(selection, Selection) else cast(SelectionType, selection) - ) - self.refresh() + ): + self.refresh() return self def deselect_all(self) -> Self: