diff --git a/src/textual/widgets/_key_panel.py b/src/textual/widgets/_key_panel.py index 104237ffdc..57626079a2 100644 --- a/src/textual/widgets/_key_panel.py +++ b/src/textual/widgets/_key_panel.py @@ -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), diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots/test_keymap_bindings_key_display.svg b/tests/snapshot_tests/__snapshots__/test_snapshots/test_keymap_bindings_key_display.svg index cc232f86be..696b127286 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots/test_keymap_bindings_key_display.svg +++ b/tests/snapshot_tests/__snapshots__/test_snapshots/test_keymap_bindings_key_display.svg @@ -19,140 +19,140 @@ font-weight: 700; } - .terminal-4136079827-matrix { + .terminal-2646538147-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-4136079827-title { + .terminal-2646538147-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-4136079827-r1 { fill: #e1e1e1 } -.terminal-4136079827-r2 { fill: #5c5c5c } -.terminal-4136079827-r3 { fill: #c5c8c6 } -.terminal-4136079827-r4 { fill: #1e1e1e } -.terminal-4136079827-r5 { fill: #fea62b;font-weight: bold } -.terminal-4136079827-r6 { fill: #ededed } -.terminal-4136079827-r7 { fill: #9a9a9a } -.terminal-4136079827-r8 { fill: #a7a9ab } -.terminal-4136079827-r9 { fill: #e2e3e3 } -.terminal-4136079827-r10 { fill: #4c5055 } + .terminal-2646538147-r1 { fill: #e1e1e1 } +.terminal-2646538147-r2 { fill: #5c5c5c } +.terminal-2646538147-r3 { fill: #c5c8c6 } +.terminal-2646538147-r4 { fill: #1e1e1e } +.terminal-2646538147-r5 { fill: #fea62b;font-weight: bold } +.terminal-2646538147-r6 { fill: #ededed } +.terminal-2646538147-r7 { fill: #9a9a9a } +.terminal-2646538147-r8 { fill: #a7a9ab } +.terminal-2646538147-r9 { fill: #e2e3e3 } +.terminal-2646538147-r10 { fill: #4c5055 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MyApp + MyApp - - - - Check the footer and help panel                    -         tabFocus Next   -   shift+tabFocus        -Previous     - -          ^cQuit         -          ^ppalette Open -command  -palette -     correctIncrement    -     correct -     correct -     correct - - - - - - - - - - - correct Increment ^p palette + + + + Check the footer and help panel                    +      tabFocus Next      +shift+tabFocus Previous  + +       ^cQuit            +       ^ppalette Open  +command palette +  correctIncrement       + + + + + + + + + + + + + + + + correct Increment ^p palette