Skip to content

Commit

Permalink
fix(help panel): prevent duplicated key displays
Browse files Browse the repository at this point in the history
  • Loading branch information
TomJGooding committed Sep 27, 2024
1 parent c75b169 commit 289a819
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed widgets occasionally not getting Resize events https://github.com/Textualize/textual/pull/5048
- Fixed tree regression https://github.com/Textualize/textual/pull/5052
- Fixed glitch with single line inline widget https://github.com/Textualize/textual/pull/5054
- Fixed duplicated key displays in the help panel https://github.com/Textualize/textual/issues/5037

## [0.80.1] - 2024-09-24

Expand Down
9 changes: 6 additions & 3 deletions src/textual/widgets/_key_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +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]
key_display = " ".join(
get_key_display(binding) for binding, _, _ in multi_bindings
)
if binding.key_display:
key_display = binding.key_display
else:
key_display = " ".join(
get_key_display(binding) for binding, _, _ in multi_bindings
)
table.add_row(
Text(key_display, style=key_style),
render_description(binding),
Expand Down
Loading

0 comments on commit 289a819

Please sign in to comment.