From f5e66b251fa8ec24989bf25861bcf4e38a561470 Mon Sep 17 00:00:00 2001 From: sf-jin-ku Date: Wed, 3 Jun 2026 09:13:01 -0700 Subject: feat: switch input source during prefix mode (#434) On macOS, opt-in under [experimental], temporarily switch the host input source to the current ASCII-capable layout while prefix mode is active so prefix commands register even when a CJK IME is composing, then restore the previous input source when prefix mode exits or is cancelled. No-op when the current source is already ASCII-capable, on non-macOS platforms, or when any input source call fails. Pane text input is unaffected. Also pin next_resize_poll in next_loop_deadline_includes_selection_autoscroll_deadline so the selection autoscroll deadline stays the earliest; the default resize poll could otherwise beat it and flake the assertion. refs #400 Co-authored-by: Can Celik --- src/app/runtime.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/app/runtime.rs') diff --git a/src/app/runtime.rs b/src/app/runtime.rs index 4ddcde6c..5bfa9141 100644 --- a/src/app/runtime.rs +++ b/src/app/runtime.rs @@ -61,9 +61,11 @@ impl App { &mut self, msg: crate::api::ApiRequestMessage, ) -> bool { + let previous_mode = self.state.mode; let changed = crate::api::request_changes_ui(&msg.request); let response = self.handle_api_request(msg.request); let _ = msg.respond_to.send(response); + self.sync_prefix_input_source(previous_mode); changed } @@ -91,6 +93,7 @@ impl App { &mut self, event: crate::raw_input::RawInputEvent, ) -> bool { + let previous_mode = self.state.mode; let changed = match event { crate::raw_input::RawInputEvent::Key(key) => { let key_id = repeat_key_identity(&key); @@ -150,6 +153,7 @@ impl App { } crate::raw_input::RawInputEvent::Unsupported => false, }; + self.sync_prefix_input_source(previous_mode); self.shutdown_detached_terminal_runtimes(); changed } @@ -552,7 +556,7 @@ impl App { break; }; had_event = true; - self.handle_internal_event(ev); + self.handle_internal_event_with_prefix_sync(ev); } had_event } -- cgit v1.2.3