mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 02:31:45 +02:00
Fix a regression in the previous release that caused multi-key sequences to not abort when pressing an unknown key
Fixes #7022
This commit is contained in:
@@ -48,6 +48,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- macOS: Fix a regression in the previous release that broke overriding keyboard shortcuts for actions present in the global menu bar (:iss:`7016`)
|
- macOS: Fix a regression in the previous release that broke overriding keyboard shortcuts for actions present in the global menu bar (:iss:`7016`)
|
||||||
|
|
||||||
|
- Fix a regression in the previous release that caused multi-key sequences to not abort when pressing an unknown key (:iss:`7022`)
|
||||||
|
|
||||||
0.32.0 [2024-01-19]
|
0.32.0 [2024-01-19]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -1371,6 +1371,12 @@ class Boss:
|
|||||||
if self.global_shortcuts_map and get_shortcut(self.global_shortcuts_map, ev):
|
if self.global_shortcuts_map and get_shortcut(self.global_shortcuts_map, ev):
|
||||||
return True
|
return True
|
||||||
if not is_root_mode:
|
if not is_root_mode:
|
||||||
|
if mode.sequence_keys is not None:
|
||||||
|
self.pop_keyboard_mode()
|
||||||
|
w = self.active_window
|
||||||
|
if w is not None:
|
||||||
|
w.send_key_sequence(*mode.sequence_keys)
|
||||||
|
return False
|
||||||
if mode.on_unknown in ('beep', 'ignore'):
|
if mode.on_unknown in ('beep', 'ignore'):
|
||||||
if mode.on_unknown == 'beep' and get_options().enable_audio_bell:
|
if mode.on_unknown == 'beep' and get_options().enable_audio_bell:
|
||||||
ring_bell()
|
ring_bell()
|
||||||
@@ -1386,16 +1392,17 @@ class Boss:
|
|||||||
if final_actions:
|
if final_actions:
|
||||||
mode_pos = len(self.keyboard_mode_stack) - 1
|
mode_pos = len(self.keyboard_mode_stack) - 1
|
||||||
if final_actions[0].is_sequence:
|
if final_actions[0].is_sequence:
|
||||||
if not mode.is_sequence:
|
if mode.sequence_keys is None:
|
||||||
sm = KeyboardMode('__sequence__')
|
sm = KeyboardMode('__sequence__')
|
||||||
sm.on_action = 'end'
|
sm.on_action = 'end'
|
||||||
sm.is_sequence = True
|
sm.sequence_keys = [ev]
|
||||||
for fa in final_actions:
|
for fa in final_actions:
|
||||||
sm.keymap[fa.rest[0]].append(fa.shift_sequence_and_copy())
|
sm.keymap[fa.rest[0]].append(fa.shift_sequence_and_copy())
|
||||||
self._push_keyboard_mode(sm)
|
self._push_keyboard_mode(sm)
|
||||||
if self.args.debug_keyboard:
|
if self.args.debug_keyboard:
|
||||||
print('\n\x1b[35mKeyPress\x1b[m matched sequence prefix, ', end='', flush=True)
|
print('\n\x1b[35mKeyPress\x1b[m matched sequence prefix, ', end='', flush=True)
|
||||||
else:
|
else:
|
||||||
|
mode.sequence_keys.append(ev)
|
||||||
if len(final_actions) == 1:
|
if len(final_actions) == 1:
|
||||||
self.pop_keyboard_mode()
|
self.pop_keyboard_mode()
|
||||||
return self.combine(final_actions[0].definition)
|
return self.combine(final_actions[0].definition)
|
||||||
|
|||||||
@@ -1234,7 +1234,7 @@ class KeyboardMode:
|
|||||||
|
|
||||||
on_unknown: OnUnknown = get_args(OnUnknown)[0]
|
on_unknown: OnUnknown = get_args(OnUnknown)[0]
|
||||||
on_action : OnAction = get_args(OnAction)[0]
|
on_action : OnAction = get_args(OnAction)[0]
|
||||||
is_sequence: bool = False
|
sequence_keys: Optional[List[defines.KeyEvent]] = None
|
||||||
|
|
||||||
def __init__(self, name: str = '') -> None:
|
def __init__(self, name: str = '') -> None:
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|||||||
@@ -913,6 +913,17 @@ class Window:
|
|||||||
passthrough = False
|
passthrough = False
|
||||||
return passthrough
|
return passthrough
|
||||||
|
|
||||||
|
def send_key_sequence(self, *keys: KeyEvent, synthesize_release_events: bool = True) -> None:
|
||||||
|
for key in keys:
|
||||||
|
enc = self.encoded_key(key)
|
||||||
|
if enc:
|
||||||
|
self.write_to_child(enc)
|
||||||
|
if synthesize_release_events and key.action != GLFW_RELEASE:
|
||||||
|
rkey = KeyEvent(key=key.key, mods=key.mods, action=GLFW_RELEASE)
|
||||||
|
enc = self.encoded_key(rkey)
|
||||||
|
if enc:
|
||||||
|
self.write_to_child(enc)
|
||||||
|
|
||||||
@ac('debug', 'Show a dump of the current lines in the scrollback + screen with their line attributes')
|
@ac('debug', 'Show a dump of the current lines in the scrollback + screen with their line attributes')
|
||||||
def dump_lines_with_attrs(self) -> None:
|
def dump_lines_with_attrs(self) -> None:
|
||||||
strings: List[str] = []
|
strings: List[str] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user