Skip to content

Commit

Permalink
Merge pull request #5437 from davep/bug/5436/fix-help-alignment
Browse files Browse the repository at this point in the history
Don't pad a key's tooltip in the help panel if it doesn't have a description
  • Loading branch information
willmcgugan authored Jan 7, 2025
2 parents ee4abfa + 59b09b0 commit 9612407
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

### Fixed

- Fixed `Pilot.click` not working with `times` parameter https://github.com/Textualize/textual/pull/5398
- Fixed select refocusing itself too late https://github.com/Textualize/textual/pull/5420
- Fixed layout of the keys in the help panel when a key has a tooltip but no description https://github.com/Textualize/textual/issues/5436
- Footer can now be scrolled horizontally without holding `shift` https://github.com/Textualize/textual/pull/5404
- The content of an `Input` will now only be automatically selected when the widget is focused by the user, not when the app itself has regained focus (similar to web browsers). https://github.com/Textualize/textual/pull/5379
- `Pilot.mouse_down` and `Pilot.mouse_up` now issue a prior `MouseMove` event, to more closely reflect real mouse actions. https://github.com/Textualize/textual/pull/5409
- Snapshots tests now discard meta, which should reduce test breaking with no visual differences https://github.com/Textualize/textual/pull/5409

Expand Down Expand Up @@ -141,7 +148,7 @@ the selection if there is one, otherwise it will cut the current line https://gi
- Added `Widget.set_scroll` https://github.com/Textualize/textual/pull/5278
- Added `Select.selection` https://github.com/Textualize/textual/pull/5278

### Fixed
### Fixed

- Fixed offset applied to docked widgets https://github.com/Textualize/textual/pull/5264
- Fixed loading widgets responding to input https://github.com/Textualize/textual/pull/5267
Expand Down Expand Up @@ -417,7 +424,7 @@ the selection if there is one, otherwise it will cut the current line https://gi

### Changed

- Removed caps_lock and num_lock modifiers https://github.com/Textualize/textual/pull/4861
- Removed caps_lock and num_lock modifiers https://github.com/Textualize/textual/pull/4861
- Keys such as escape and space are now displayed in lower case in footer https://github.com/Textualize/textual/pull/4876
- Changed default command palette binding to `ctrl+p` https://github.com/Textualize/textual/pull/4867
- Removed `ctrl_to_caret` and `upper_case_keys` from Footer. These can be implemented in `App.get_key_display`.
Expand Down Expand Up @@ -624,7 +631,7 @@ when an expandable node is selected https://github.com/Textualize/textual/pull/4

### Added

- Added `Screen.is_active`
- Added `Screen.is_active`
- Added `icon` reactive to Header widget https://github.com/Textualize/textual/pull/4627
- Added `time_format` reactive to Header widget https://github.com/Textualize/textual/pull/4627
- Added `tooltip` parameter to input widgets https://github.com/Textualize/textual/pull/4625
Expand Down
13 changes: 7 additions & 6 deletions src/textual/widgets/_key_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def render_description(binding: Binding) -> Text:
binding.description, end="", style=description_style
)
if binding.tooltip:
text.append(" ")
if binding.description:
text.append(" ")
text.append(binding.tooltip, "dim")
return text

Expand Down Expand Up @@ -119,19 +120,19 @@ class KeyPanel(VerticalScroll, can_focus=False):
"""

DEFAULT_CSS = """
KeyPanel {
KeyPanel {
split: right;
width: 33%;
min-width: 30;
max-width: 60;
min-width: 30;
max-width: 60;
border-left: vkey $foreground 30%;
padding: 0 1;
height: 1fr;
padding-right: 1;
align: center top;
&> BindingsTable > .bindings-table--key {
color: $accent;
color: $accent;
text-style: bold;
padding: 0 1;
}
Expand All @@ -151,7 +152,7 @@ class KeyPanel(VerticalScroll, can_focus=False):
#bindings-table {
width: auto;
height: auto;
}
}
}
"""

Expand Down

0 comments on commit 9612407

Please sign in to comment.