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:
parent
bef4905416
commit
86ce11134a
@ -4,6 +4,13 @@ Changelog
|
||||
|kitty| is a feature-rich, cross-platform, *fast*, GPU based terminal.
|
||||
To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
|
||||
0.20.4 [future]
|
||||
----------------------
|
||||
|
||||
- Unicode input kitten: Fix a regression in 0.20.0 that broke keyboard handling
|
||||
when the num lock or caps lock modifiers were engaged. (:iss:`3587`)
|
||||
|
||||
|
||||
0.20.3 [2021-05-06]
|
||||
----------------------
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class Resize(Handler):
|
||||
if key_event.matches('esc'):
|
||||
self.quit_loop(0)
|
||||
return
|
||||
if key_event.key in ('w', 'n', 't', 's') and key_event.mods == CTRL:
|
||||
if key_event.key in ('w', 'n', 't', 's') and key_event.mods_without_locks == CTRL:
|
||||
self.do_window_resize(is_decrease=key_event.key in 'ns', is_horizontal=key_event.key in 'wn', multiplier=2)
|
||||
|
||||
def on_resize(self, new_size: ScreenSize) -> None:
|
||||
|
||||
@ -416,7 +416,7 @@ class UnicodeInput(Handler):
|
||||
self.refresh()
|
||||
|
||||
def on_key(self, key_event: KeyEvent) -> None:
|
||||
if self.mode is HEX and key_event.type is not EventType.RELEASE and not key_event.mods:
|
||||
if self.mode is HEX and key_event.type is not EventType.RELEASE and not key_event.has_mods:
|
||||
try:
|
||||
val = int(self.line_edit.current_input, 16)
|
||||
except Exception:
|
||||
@ -434,7 +434,7 @@ class UnicodeInput(Handler):
|
||||
self.line_edit.current_input = hex(val - 1)[2:]
|
||||
self.refresh()
|
||||
return
|
||||
if self.mode is NAME and key_event.type is not EventType.RELEASE and not key_event.mods:
|
||||
if self.mode is NAME and key_event.type is not EventType.RELEASE and not key_event.has_mods:
|
||||
if key_event.matches('shift+tab'):
|
||||
self.table.move_current(cols=-1)
|
||||
self.refresh()
|
||||
|
||||
10
kitty/key_encoding.py
generated
10
kitty/key_encoding.py
generated
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user