diff --git a/src/textual/widgets/_key_panel.py b/src/textual/widgets/_key_panel.py index 503e750058..ea5a7173c5 100644 --- a/src/textual/widgets/_key_panel.py +++ b/src/textual/widgets/_key_panel.py @@ -90,12 +90,11 @@ def render_description(binding: Binding) -> Text: get_key_display = self.app.get_key_display for multi_bindings in action_to_bindings.values(): binding, enabled, tooltip = multi_bindings[0] - unique_key_displays: list[str] = [] - for binding, _, _ in multi_bindings: - key_display = get_key_display(binding) - if key_display not in unique_key_displays: - unique_key_displays.append(key_display) - keys_display = " ".join(unique_key_displays) + keys_display = " ".join( + dict.fromkeys( # Remove duplicates while preserving order + get_key_display(binding) for binding, _, _ in multi_bindings + ) + ) table.add_row( Text(keys_display, style=key_style), render_description(binding),