Skip to content

Commit

Permalink
de-dupe key displaus with keymaps
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJGooding committed Oct 11, 2024
1 parent 39c5195 commit 9aa73f0
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 70 deletions.
12 changes: 6 additions & 6 deletions src/textual/widgets/_key_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ 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]
if binding.key_display:
key_display = binding.key_display
else:
key_display = " ".join(
get_key_display(binding) for binding, _, _ in multi_bindings
)
unique_keys: list[str] = []
for binding, _, _ in multi_bindings:
key_display = get_key_display(binding)
if key_display not in unique_keys:
unique_keys.append(key_display)
key_display = " ".join(unique_keys)
table.add_row(
Text(key_display, style=key_style),
render_description(binding),
Expand Down
Loading

0 comments on commit 9aa73f0

Please sign in to comment.