macOS: Fix kitten @ select-window leaving the keyboard in a partially functional state

Fixes #7074
This commit is contained in:
Kovid Goyal
2024-01-27 12:53:58 +05:30
parent cafd5a7471
commit 5a2ee2f9a3
4 changed files with 11 additions and 2 deletions

View File

@@ -52,6 +52,8 @@ Detailed list of changes
- Fix a single key mapping not overriding a previously defined multi-key mapping
- macOS: Fix :code:`kitten @ select-window` leaving the keyboard in a partially functional state (:iss:`7074`)
0.32.1 [2024-01-26]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -295,7 +295,6 @@ class VisualSelect:
set_os_window_title(self.os_window_id, '')
boss = get_boss()
redirect_mouse_handling(False)
boss.mappings.clear_keyboard_modes()
for wid in self.window_ids:
w = boss.window_id_map.get(wid)
if w is not None:

View File

@@ -80,6 +80,7 @@ class Mappings:
def clear_keyboard_modes(self) -> None:
self.keyboard_mode_stack = []
self.set_ignore_os_keyboard_processing(False)
def pop_keyboard_mode(self) -> bool:
passthrough = True

View File

@@ -527,6 +527,7 @@ class TestKeys(BaseTest):
bad_lines = []
self.options = load_config(overrides=lines, accumulate_bad_lines=bad_lines)
af(bad_lines)
self.ignore_os_keyboard_processing = False
super().__init__()
def get_active_window(self):
@@ -555,7 +556,7 @@ class TestKeys(BaseTest):
return bool(action_definition)
def set_ignore_os_keyboard_processing(self, on: bool) -> None:
pass
self.ignore_os_keyboard_processing = on
def set_cocoa_global_shortcuts(self, opts):
return {}
@@ -640,3 +641,9 @@ class TestKeys(BaseTest):
self.ae(tm.actions, ['neighboring_window left'])
self.ae(tm('x'), [True])
af(tm.keyboard_mode_stack)
# modal mapping with --on-action=end must restore OS keyboard processing
tm = TM('map --new-mode mw --on-action end m', 'map --mode mw a new_window')
self.ae(tm('m', 'a'), [True, True])
self.ae(tm.actions, ['push_keyboard_mode mw', 'new_window'])
af(tm.ignore_os_keyboard_processing)