Skip to content

Commit 6475527

Browse files
committed
keys: Add a common suffix for all urwid_readline hotkeys.
Tests updated to not use readline hotkeys.
1 parent f65f8f2 commit 6475527

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

tests/config/test_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_display_key_for_urwid_key(urwid_key: str, display_key: str) -> None:
142142

143143

144144
COMMAND_TO_DISPLAY_KEYS = [
145-
("NEXT_LINE", ["Down", "Ctrl n"]),
145+
("SEND_MESSAGE", ["Ctrl d", "Meta Enter"]),
146146
("TOGGLE_STAR_STATUS", ["Ctrl s", "*"]),
147147
("ALL_PM", ["P"]),
148148
]

zulipterminal/config/keys.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
)
1818

1919

20+
READLINE_SUFFIX = "_READLINE"
21+
22+
2023
class KeyBinding(TypedDict):
2124
keys: List[str]
2225
help_text: str
@@ -320,77 +323,77 @@ class KeyBinding(TypedDict):
320323
'help_text': 'View user information (From Users list)',
321324
'key_category': 'general',
322325
},
323-
'BEGINNING_OF_LINE': {
326+
'BEGINNING_OF_LINE' + READLINE_SUFFIX: {
324327
'keys': ['ctrl a'],
325328
'help_text': 'Jump to the beginning of line',
326329
'key_category': 'msg_compose',
327330
},
328-
'END_OF_LINE': {
331+
'END_OF_LINE' + READLINE_SUFFIX: {
329332
'keys': ['ctrl e'],
330333
'help_text': 'Jump to the end of line',
331334
'key_category': 'msg_compose',
332335
},
333-
'ONE_WORD_BACKWARD': {
336+
'ONE_WORD_BACKWARD' + READLINE_SUFFIX: {
334337
'keys': ['meta b'],
335338
'help_text': 'Jump backward one word',
336339
'key_category': 'msg_compose',
337340
},
338-
'ONE_WORD_FORWARD': {
341+
'ONE_WORD_FORWARD' + READLINE_SUFFIX: {
339342
'keys': ['meta f'],
340343
'help_text': 'Jump forward one word',
341344
'key_category': 'msg_compose',
342345
},
343-
'DELETE_LAST_CHARACTER': {
346+
'DELETE_LAST_CHARACTER' + READLINE_SUFFIX: {
344347
'keys': ['ctrl h'],
345348
'help_text': 'Delete previous character (to left)',
346349
'key_category': 'msg_compose',
347350
},
348-
'TRANSPOSE_CHARACTERS': {
351+
'TRANSPOSE_CHARACTERS' + READLINE_SUFFIX: {
349352
'keys': ['ctrl t'],
350353
'help_text': 'Transpose characters',
351354
'key_category': 'msg_compose',
352355
},
353-
'CUT_TO_END_OF_LINE': {
356+
'CUT_TO_END_OF_LINE' + READLINE_SUFFIX: {
354357
'keys': ['ctrl k'],
355358
'help_text': 'Cut forwards to the end of the line',
356359
'key_category': 'msg_compose',
357360
},
358-
'CUT_TO_START_OF_LINE': {
361+
'CUT_TO_START_OF_LINE' + READLINE_SUFFIX: {
359362
'keys': ['ctrl u'],
360363
'help_text': 'Cut backwards to the start of the line',
361364
'key_category': 'msg_compose',
362365
},
363-
'CUT_TO_END_OF_WORD': {
366+
'CUT_TO_END_OF_WORD' + READLINE_SUFFIX: {
364367
'keys': ['meta d'],
365368
'help_text': 'Cut forwards to the end of the current word',
366369
'key_category': 'msg_compose',
367370
},
368-
'CUT_TO_START_OF_WORD': {
371+
'CUT_TO_START_OF_WORD' + READLINE_SUFFIX: {
369372
'keys': ['ctrl w'],
370373
'help_text': 'Cut backwards to the start of the current word',
371374
'key_category': 'msg_compose',
372375
},
373-
'PASTE_LAST_CUT': {
376+
'PASTE_LAST_CUT' + READLINE_SUFFIX: {
374377
'keys': ['ctrl y'],
375378
'help_text': 'Paste last cut section',
376379
'key_category': 'msg_compose',
377380
},
378-
'UNDO_LAST_ACTION': {
381+
'UNDO_LAST_ACTION' + READLINE_SUFFIX: {
379382
'keys': ['ctrl _'],
380383
'help_text': 'Undo last action',
381384
'key_category': 'msg_compose',
382385
},
383-
'PREV_LINE': {
386+
'PREV_LINE' + READLINE_SUFFIX: {
384387
'keys': ['up', 'ctrl p'],
385388
'help_text': 'Jump to the previous line',
386389
'key_category': 'msg_compose',
387390
},
388-
'NEXT_LINE': {
391+
'NEXT_LINE' + READLINE_SUFFIX: {
389392
'keys': ['down', 'ctrl n'],
390393
'help_text': 'Jump to the next line',
391394
'key_category': 'msg_compose',
392395
},
393-
'CLEAR_MESSAGE': {
396+
'CLEAR_MESSAGE' + READLINE_SUFFIX: {
394397
'keys': ['ctrl l'],
395398
'help_text': 'Clear compose box',
396399
'key_category': 'msg_compose',

0 commit comments

Comments
 (0)