Skip to content

Commit 1e3d018

Browse files
authored
Merge pull request #5062 from Textualize/binding-descriptions
Updating descriptions in BINDINGS
2 parents c5f8726 + 9de0856 commit 1e3d018

File tree

12 files changed

+149
-136
lines changed

12 files changed

+149
-136
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010
### Added
1111

1212
- Added support for keymaps (user configurable key bindings) https://github.com/Textualize/textual/pull/5038
13+
- Added descriptions to bindings for all internal widgets, and updated casing to be consistent https://github.com/Textualize/textual/pull/5062
1314

1415
## [0.81.0] - 2024-09-25
1516

src/textual/command.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,23 @@ class CommandPalette(SystemModalScreen):
537537
"""
538538

539539
BINDINGS: ClassVar[list[BindingType]] = [
540-
Binding("ctrl+end, shift+end", "command_list('last')", show=False),
541-
Binding("ctrl+home, shift+home", "command_list('first')", show=False),
542-
Binding("down", "cursor_down", show=False),
540+
Binding(
541+
"ctrl+end, shift+end",
542+
"command_list('last')",
543+
"Go to bottom",
544+
show=False,
545+
),
546+
Binding(
547+
"ctrl+home, shift+home",
548+
"command_list('first')",
549+
"Go to top",
550+
show=False,
551+
),
552+
Binding("down", "cursor_down", "Next command", show=False),
543553
Binding("escape", "escape", "Exit the command palette"),
544-
Binding("pagedown", "command_list('page_down')", show=False),
545-
Binding("pageup", "command_list('page_up')", show=False),
546-
Binding("up", "command_list('cursor_up')", show=False),
554+
Binding("pagedown", "command_list('page_down')", "Next page", show=False),
555+
Binding("pageup", "command_list('page_up')", "Previous page", show=False),
556+
Binding("up", "command_list('cursor_up')", "Previous command", show=False),
547557
]
548558
"""
549559
| Key(s) | Description |

src/textual/widgets/_button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class Button(Widget, can_focus=True):
146146
}
147147
"""
148148

149-
BINDINGS = [Binding("enter", "press", "Press Button", show=False)]
149+
BINDINGS = [Binding("enter", "press", "Press button", show=False)]
150150

151151
label: reactive[TextType] = reactive[TextType]("")
152152
"""The text label that appears within the button."""

src/textual/widgets/_data_table.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
261261

262262
BINDINGS: ClassVar[list[BindingType]] = [
263263
Binding("enter", "select_cursor", "Select", show=False),
264-
Binding("up", "cursor_up", "Cursor Up", show=False),
265-
Binding("down", "cursor_down", "Cursor Down", show=False),
266-
Binding("right", "cursor_right", "Cursor Right", show=False),
267-
Binding("left", "cursor_left", "Cursor Left", show=False),
268-
Binding("pageup", "page_up", "Page Up", show=False),
269-
Binding("pagedown", "page_down", "Page Down", show=False),
264+
Binding("up", "cursor_up", "Cursor up", show=False),
265+
Binding("down", "cursor_down", "Cursor down", show=False),
266+
Binding("right", "cursor_right", "Cursor right", show=False),
267+
Binding("left", "cursor_left", "Cursor left", show=False),
268+
Binding("pageup", "page_up", "Page up", show=False),
269+
Binding("pagedown", "page_down", "Page down", show=False),
270270
Binding("ctrl+home", "scroll_top", "Top", show=False),
271271
Binding("ctrl+end", "scroll_bottom", "Bottom", show=False),
272272
Binding("home", "scroll_home", "Home", show=False),

src/textual/widgets/_input.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,25 @@ class Input(Widget, can_focus=True):
9393
"""A text input widget."""
9494

9595
BINDINGS: ClassVar[list[BindingType]] = [
96-
Binding("left", "cursor_left", "cursor left", show=False),
97-
Binding("ctrl+left", "cursor_left_word", "cursor left word", show=False),
98-
Binding("right", "cursor_right", "cursor right", show=False),
99-
Binding("ctrl+right", "cursor_right_word", "cursor right word", show=False),
100-
Binding("backspace", "delete_left", "delete left", show=False),
101-
Binding("home,ctrl+a", "home", "home", show=False),
102-
Binding("end,ctrl+e", "end", "end", show=False),
103-
Binding("delete,ctrl+d", "delete_right", "delete right", show=False),
104-
Binding("enter", "submit", "submit", show=False),
96+
Binding("left", "cursor_left", "Move cursor left", show=False),
97+
Binding("ctrl+left", "cursor_left_word", "Move cursor left a word", show=False),
98+
Binding("right", "cursor_right", "Move cursor right", show=False),
10599
Binding(
106-
"ctrl+w", "delete_left_word", "delete left to start of word", show=False
100+
"ctrl+right", "cursor_right_word", "Move cursor right a word", show=False
107101
),
108-
Binding("ctrl+u", "delete_left_all", "delete all to the left", show=False),
102+
Binding("backspace", "delete_left", "Delete character left", show=False),
103+
Binding("home,ctrl+a", "home", "Go to start", show=False),
104+
Binding("end,ctrl+e", "end", "Go to end", show=False),
105+
Binding("delete,ctrl+d", "delete_right", "Delete character right", show=False),
106+
Binding("enter", "submit", "Submit", show=False),
109107
Binding(
110-
"ctrl+f", "delete_right_word", "delete right to start of word", show=False
108+
"ctrl+w", "delete_left_word", "Delete left to start of word", show=False
111109
),
112-
Binding("ctrl+k", "delete_right_all", "delete all to the right", show=False),
110+
Binding("ctrl+u", "delete_left_all", "Delete all to the left", show=False),
111+
Binding(
112+
"ctrl+f", "delete_right_word", "Delete right to start of word", show=False
113+
),
114+
Binding("ctrl+k", "delete_right_all", "Delete all to the right", show=False),
113115
]
114116
"""
115117
| Key(s) | Description |

src/textual/widgets/_list_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class ListView(VerticalScroll, can_focus=True, can_focus_children=False):
2727

2828
BINDINGS: ClassVar[list[BindingType]] = [
2929
Binding("enter", "select_cursor", "Select", show=False),
30-
Binding("up", "cursor_up", "Cursor Up", show=False),
31-
Binding("down", "cursor_down", "Cursor Down", show=False),
30+
Binding("up", "cursor_up", "Cursor up", show=False),
31+
Binding("down", "cursor_down", "Cursor down", show=False),
3232
]
3333
"""
3434
| Key(s) | Description |

src/textual/widgets/_option_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ class OptionList(ScrollView, can_focus=True):
119119
Binding("end", "last", "Last", show=False),
120120
Binding("enter", "select", "Select", show=False),
121121
Binding("home", "first", "First", show=False),
122-
Binding("pagedown", "page_down", "Page Down", show=False),
123-
Binding("pageup", "page_up", "Page Up", show=False),
122+
Binding("pagedown", "page_down", "Page down", show=False),
123+
Binding("pageup", "page_up", "Page up", show=False),
124124
Binding("up", "cursor_up", "Up", show=False),
125125
]
126126
"""

src/textual/widgets/_radio_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class RadioSet(Container, can_focus=True, can_focus_children=False):
6262
"""
6363

6464
BINDINGS: ClassVar[list[BindingType]] = [
65-
Binding("down,right", "next_button", "", show=False),
65+
Binding("down,right", "next_button", "Next option", show=False),
6666
Binding("enter,space", "toggle_button", "Toggle", show=False),
67-
Binding("up,left", "previous_button", "", show=False),
67+
Binding("up,left", "previous_button", "Previous option", show=False),
6868
]
6969
"""
7070
| Key(s) | Description |

src/textual/widgets/_select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class EmptySelectError(Exception):
4343
class SelectOverlay(OptionList):
4444
"""The 'pop-up' overlay for the Select control."""
4545

46-
BINDINGS = [("escape", "dismiss")]
46+
BINDINGS = [("escape", "dismiss", "Dismiss menu")]
4747

4848
DEFAULT_CSS = """
4949
SelectOverlay {
@@ -200,7 +200,7 @@ class Select(Generic[SelectType], Vertical, can_focus=True):
200200
"""Constant to flag that the widget has no selection."""
201201

202202
BINDINGS = [
203-
Binding("enter,down,space,up", "show_overlay", show=False),
203+
Binding("enter,down,space,up", "show_overlay", "Show menu", show=False),
204204
]
205205
"""
206206
| Key(s) | Description |

src/textual/widgets/_selection_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def initial_state(self) -> bool:
7171
class SelectionList(Generic[SelectionType], OptionList):
7272
"""A vertical selection list that allows making multiple selections."""
7373

74-
BINDINGS = [Binding("space", "select")]
74+
BINDINGS = [Binding("space", "select", "Toggle option", show=False)]
7575
"""
7676
| Key(s) | Description |
7777
| :- | :- |

0 commit comments

Comments
 (0)