This commit is contained in:
Kovid Goyal 2021-05-11 10:33:01 +05:30
parent c50863c0d5
commit eeaf67079a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -742,11 +742,15 @@ class Boss:
window_for_dispatch: Optional[Window] = None, window_for_dispatch: Optional[Window] = None,
dispatch_type: str = 'KeyPress' dispatch_type: str = 'KeyPress'
) -> bool: ) -> bool:
def report_match(f: Callable) -> None:
if self.args.debug_keyboard:
print(f'\x1b[35m{dispatch_type}\x1b[m matched action:', func_name(f), flush=True)
if key_action is not None: if key_action is not None:
f = getattr(self, key_action.func, None) f = getattr(self, key_action.func, None)
if f is not None: if f is not None:
if self.args.debug_keyboard: report_match(f)
print(f'{dispatch_type} matched action:', func_name(f), flush=True)
passthrough = f(*key_action.args) passthrough = f(*key_action.args)
if passthrough is not True: if passthrough is not True:
return True return True
@ -762,8 +766,7 @@ class Boss:
f = getattr(tab, key_action.func, getattr(window, key_action.func, None)) f = getattr(tab, key_action.func, getattr(window, key_action.func, None))
if f is not None: if f is not None:
passthrough = f(*key_action.args) passthrough = f(*key_action.args)
if self.args.debug_keyboard: report_match(f)
print(f'{dispatch_type} matched action:', func_name(f))
if passthrough is not True: if passthrough is not True:
return True return True
return False return False