diff --git a/tools/lint-hotkeys b/tools/lint-hotkeys index 969ff228ac..f127d2ee35 100755 --- a/tools/lint-hotkeys +++ b/tools/lint-hotkeys @@ -11,7 +11,10 @@ from zulipterminal.config.keys import ( KEY_BINDINGS, display_keys_for_command, ) -from zulipterminal.config.regexes import REGEX_READLINE_COMMANDS +from zulipterminal.config.regexes import ( + REGEX_READLINE_COMMANDS, + REGEX_TERMINAL_COMMANDS, +) # absolute path to zulip-terminal @@ -52,6 +55,11 @@ def lint_all_external_commands() -> None: command_type="Urwid Readline", suffix="READLINE_SUFFIX", ) + lint_external_commands_by_type( + regex_pattern=REGEX_TERMINAL_COMMANDS, + command_type="General terminal", + suffix="GENERAL_TERMINAL_SUFFIX", + ) print("All external commands have been linted successfully.") diff --git a/zulipterminal/config/keys.py b/zulipterminal/config/keys.py index 8bc5df981b..c807664efb 100644 --- a/zulipterminal/config/keys.py +++ b/zulipterminal/config/keys.py @@ -18,6 +18,7 @@ READLINE_SUFFIX = "_READLINE" +GENERAL_TERMINAL_SUFFIX = "_GENERAL_TERMINAL" class KeyBinding(TypedDict): @@ -308,12 +309,12 @@ class KeyBinding(TypedDict): 'excluded_from_random_tips': True, 'key_category': 'stream_list', }, - 'REDRAW': { + 'REDRAW' + GENERAL_TERMINAL_SUFFIX: { 'keys': ['ctrl l'], 'help_text': 'Redraw screen', 'key_category': 'general', }, - 'QUIT': { + 'QUIT' + GENERAL_TERMINAL_SUFFIX: { 'keys': ['ctrl c'], 'help_text': 'Quit', 'key_category': 'general', diff --git a/zulipterminal/config/regexes.py b/zulipterminal/config/regexes.py index c3fe8e27f7..26f0e15bf1 100644 --- a/zulipterminal/config/regexes.py +++ b/zulipterminal/config/regexes.py @@ -7,7 +7,7 @@ # (*) Stream and topic regexes -from zulipterminal.config.keys import READLINE_SUFFIX +from zulipterminal.config.keys import GENERAL_TERMINAL_SUFFIX, READLINE_SUFFIX REGEX_STREAM_NAME = r"([^*>]+)" @@ -53,3 +53,5 @@ # Example: UNDO_LAST_ACTION_READLINE REGEX_READLINE_COMMANDS = rf"([A-Z_]+{READLINE_SUFFIX})" +# Example: REDRAW_GENERAL_TERMINAL +REGEX_TERMINAL_COMMANDS = rf"^.*([A-Z_]+{GENERAL_TERMINAL_SUFFIX})"