From 5bc2cde4543be17f2169a22d87355d1b620dd4ba Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Dec 2023 17:19:08 +0530 Subject: [PATCH] Add --debug-input output for sequence prefix matches --- kitty/boss.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kitty/boss.py b/kitty/boss.py index 939c5688e21..361d30ef206 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1381,10 +1381,14 @@ def dispatch_possible_special_key(self, ev: KeyEvent) -> bool: for fa in final_actions: sm.keymap[fa.rest[0]].append(fa.shift_sequence_and_copy()) self._push_keyboard_mode(sm) + if self.args.debug_keyboard: + print('\n\x1b[35mKeyPress\x1b[m matched sequence prefix, ', end='', flush=True) else: if len(final_actions) == 1: self.pop_keyboard_mode() return self.combine(final_actions[0].definition) + if self.args.debug_keyboard: + print('\n\x1b[35mKeyPress\x1b[m matched sequence prefix, ', end='', flush=True) mode.keymap.clear() for fa in final_actions: mode.keymap[fa.rest[0]].append(fa.shift_sequence_and_copy()) @@ -1589,7 +1593,8 @@ def dispatch_action( def report_match(f: Callable[..., Any]) -> None: if self.args.debug_keyboard: prefix = '\n' if dispatch_type == 'KeyPress' else '' - print(f'{prefix}\x1b[35m{dispatch_type}\x1b[m matched action:', func_name(f), flush=True) + end = ', ' if dispatch_type == 'KeyPress' else '\n' + print(f'{prefix}\x1b[35m{dispatch_type}\x1b[m matched action:', func_name(f), end=end, flush=True) if key_action is not None: f = getattr(self, key_action.func, None)