Skip to content

Commit d46b6d8

Browse files
Niloth-pneiljp
authored andcommitted
keys/boxes: Convert remaining GO_BACK command use into EXIT_COMPOSE.
Tests updated. Hotkeys document regenerated.
1 parent 8fea559 commit d46b6d8

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

docs/hotkeys.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
|Show/hide Help Menu|<kbd>?</kbd>|
99
|Show/hide Markdown Help Menu|<kbd>Meta</kbd> + <kbd>m</kbd>|
1010
|Show/hide About Menu|<kbd>Meta</kbd> + <kbd>?</kbd>|
11-
|Go back|<kbd>Esc</kbd>|
1211
|Open draft message saved in this session|<kbd>d</kbd>|
1312
|Copy information from About Menu to clipboard|<kbd>c</kbd>|
1413
|Redraw screen|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
@@ -87,6 +86,7 @@
8786
|Autocomplete @mentions, #stream_names, :emoji: and topics|<kbd>Ctrl</kbd> + <kbd>f</kbd>|
8887
|Cycle through autocomplete suggestions in reverse|<kbd>Ctrl</kbd> + <kbd>r</kbd>|
8988
|Narrow to compose box message recipient|<kbd>Meta</kbd> + <kbd>.</kbd>|
89+
|Exit message compose box|<kbd>Esc</kbd>|
9090
|Insert new line|<kbd>Enter</kbd>|
9191

9292
## Editor: Navigation

tests/ui_tools/test_boxes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_not_calling_send_private_message_without_recipients(
235235

236236
assert not write_box.model.send_private_message.called
237237

238-
@pytest.mark.parametrize("key", keys_for_command("GO_BACK"))
238+
@pytest.mark.parametrize("key", keys_for_command("EXIT_COMPOSE"))
239239
def test__compose_attributes_reset_for_private_compose(
240240
self,
241241
key: str,
@@ -256,7 +256,7 @@ def test__compose_attributes_reset_for_private_compose(
256256
assert write_box.msg_write_box.edit_text == ""
257257
assert write_box.compose_box_status == "closed"
258258

259-
@pytest.mark.parametrize("key", keys_for_command("GO_BACK"))
259+
@pytest.mark.parametrize("key", keys_for_command("EXIT_COMPOSE"))
260260
def test__compose_attributes_reset_for_stream_compose(
261261
self,
262262
key: str,
@@ -1516,7 +1516,7 @@ def test_keypress_SEND_MESSAGE_no_topic(
15161516
(primary_key_for_command("AUTOCOMPLETE"), True, True, False),
15171517
(primary_key_for_command("AUTOCOMPLETE_REVERSE"), True, True, False),
15181518
# footer resets
1519-
(primary_key_for_command("GO_BACK"), True, False, True),
1519+
(primary_key_for_command("EXIT_COMPOSE"), True, False, True),
15201520
("space", True, False, True),
15211521
("k", True, False, True),
15221522
],

zulipterminal/config/keys.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ class KeyBinding(TypedDict):
4646
'help_text': 'Show/hide About Menu',
4747
'key_category': 'general',
4848
},
49-
'GO_BACK': {
50-
'keys': ['esc'],
51-
'help_text': 'Go back',
52-
'excluded_from_random_tips': False,
53-
'key_category': 'general',
54-
},
5549
'OPEN_DRAFT': {
5650
'keys': ['d'],
5751
'help_text': 'Open draft message saved in this session',
@@ -188,6 +182,11 @@ class KeyBinding(TypedDict):
188182
'help_text': 'Narrow to compose box message recipient',
189183
'key_category': 'msg_compose',
190184
},
185+
'EXIT_COMPOSE': {
186+
'keys': ['esc'],
187+
'help_text': 'Exit message compose box',
188+
'key_category': 'msg_compose',
189+
},
191190
'TOGGLE_NARROW': {
192191
'keys': ['z'],
193192
'help_text':

zulipterminal/ui_tools/boxes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
775775
if success:
776776
self.msg_write_box.edit_text = ""
777777
if self.msg_edit_state is not None:
778-
self.keypress(size, primary_key_for_command("GO_BACK"))
778+
self.keypress(size, primary_key_for_command("EXIT_COMPOSE"))
779779
assert self.msg_edit_state is None
780780
elif is_command_key("NARROW_MESSAGE_RECIPIENT", key):
781781
if self.compose_box_status == "open_with_stream":
@@ -798,7 +798,7 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
798798
self.view.controller.report_error(
799799
"Cannot narrow to message without specifying recipients."
800800
)
801-
elif is_command_key("GO_BACK", key):
801+
elif is_command_key("EXIT_COMPOSE", key):
802802
self.send_stop_typing_status()
803803
self._set_compose_attributes_to_defaults()
804804
self.view.controller.exit_editor_mode()

0 commit comments

Comments
 (0)