Skip to content

Commit f441bac

Browse files
committed
keys: Add space key as an additional trigger of ACTIVATE_BUTTON command.
For consistency with Urwid's ACTIVATE command. Urwid's command map is updated to link Urwid's ACTIVATE with our ACTIVATE_BUTTON command. Although they currently use the same keys, they are synced to ensure future compatibility. Hotkeys document regenerated. Tests updated.
1 parent 522339a commit f441bac

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

docs/hotkeys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
|Scroll up|<kbd>PgUp</kbd> / <kbd>K</kbd>|
2525
|Scroll down|<kbd>PgDn</kbd> / <kbd>J</kbd>|
2626
|Go to bottom / Last message|<kbd>End</kbd> / <kbd>G</kbd>|
27-
|Trigger the selected entry|<kbd>Enter</kbd>|
27+
|Trigger the selected entry|<kbd>Enter</kbd> / |
2828
|Narrow to all messages|<kbd>a</kbd> / <kbd>Esc</kbd>|
2929
|Narrow to all direct messages|<kbd>P</kbd>|
3030
|Narrow to all starred messages|<kbd>f</kbd>|

tests/ui_tools/test_messages.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pytest import param as case
88
from urwid import Columns, Divider, Padding, Text
99

10-
from zulipterminal.config.keys import keys_for_command
10+
from zulipterminal.config.keys import keys_for_command, primary_key_for_command
1111
from zulipterminal.config.symbols import (
1212
ALL_MESSAGES_MARKER,
1313
DIRECT_MESSAGE_MARKER,
@@ -1968,6 +1968,7 @@ def test_footlinks_limit(self, maximum_footlinks, expected_instance):
19681968
def test_mouse_event_left_click(
19691969
self, mocker, msg_box, key, widget_size, compose_box_is_open
19701970
):
1971+
expected_keypress = primary_key_for_command("ACTIVATE_BUTTON")
19711972
size = widget_size(msg_box)
19721973
col = 1
19731974
row = 1
@@ -1981,4 +1982,4 @@ def test_mouse_event_left_click(
19811982
if compose_box_is_open:
19821983
msg_box.keypress.assert_not_called()
19831984
else:
1984-
msg_box.keypress.assert_called_once_with(size, key)
1985+
msg_box.keypress.assert_called_once_with(size, expected_keypress)

zulipterminal/config/keys.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from typing_extensions import NotRequired, TypedDict
88
from urwid.command_map import (
9+
ACTIVATE,
910
CURSOR_DOWN,
1011
CURSOR_LEFT,
1112
CURSOR_MAX_RIGHT,
@@ -92,7 +93,7 @@ class KeyBinding(TypedDict):
9293
'key_category': 'navigation',
9394
},
9495
'ACTIVATE_BUTTON': {
95-
'keys': ['enter'],
96+
'keys': ['enter', ' '],
9697
'help_text': 'Trigger the selected entry',
9798
'key_category': 'navigation',
9899
},
@@ -445,6 +446,7 @@ class KeyBinding(TypedDict):
445446
"SCROLL_UP": CURSOR_PAGE_UP,
446447
"SCROLL_DOWN": CURSOR_PAGE_DOWN,
447448
"GO_TO_BOTTOM": CURSOR_MAX_RIGHT,
449+
"ACTIVATE_BUTTON": ACTIVATE,
448450
}
449451

450452

0 commit comments

Comments
 (0)