Unicode input kitten: Fix a regression in 0.20.0 that broke keyboard handling when the num lock or caps lock modifiers were engaged.

Fixes #3587
This commit is contained in:
Kovid Goyal
2021-05-07 06:55:25 +05:30
parent bef4905416
commit 86ce11134a
4 changed files with 19 additions and 4 deletions

10
kitty/key_encoding.py generated
View File

@@ -216,7 +216,7 @@ class KeyEvent(NamedTuple):
num_lock: bool = False
def matches(self, spec: Union[str, ParsedShortcut], types: int = EventType.PRESS | EventType.REPEAT) -> bool:
mods = self.mods & ~(NUM_LOCK | CAPS_LOCK)
mods = self.mods_without_locks
if not self.type & types:
return False
if isinstance(spec, str):
@@ -228,6 +228,14 @@ class KeyEvent(NamedTuple):
return True
return False
@property
def mods_without_locks(self) -> int:
return self.mods & ~(NUM_LOCK | CAPS_LOCK)
@property
def has_mods(self) -> bool:
return bool(self.mods_without_locks)
def as_window_system_event(self) -> WindowSystemKeyEvent:
action = defines.GLFW_PRESS
if self.type is EventType.REPEAT: