diff options
| author | sf-jin-ku <jin.ku@sendbird.com> | 2026-06-03 09:13:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-03 19:13:01 +0300 |
| commit | f5e66b251fa8ec24989bf25861bcf4e38a561470 (patch) | |
| tree | 3244ffd1af0054334f8fe65ddbb0ff6f5a809cd3 /src/config | |
| parent | 03f68b7275f07c98769bf699d2aa14805b921f8d (diff) | |
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 <ogulcancelik@gmail.com>
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/model.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/config/model.rs b/src/config/model.rs index 7895341f..9fda88f4 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -477,6 +477,12 @@ pub struct ExperimentalConfig { /// Cursor shape rendered for the IME anchor when /// `reveal_hidden_cursor_for_cjk_ime` is enabled. Default: "steady_block". pub cjk_ime_cursor_shape: ImeCursorShape, + /// While prefix mode is active, temporarily switch the macOS host input + /// source to an ASCII-capable keyboard layout so prefix commands are read + /// as ASCII even when a CJK IME is active, then restore the previous input + /// source when prefix mode exits. macOS only; a no-op elsewhere and a + /// best-effort no-op if the switch fails. Default: false. + pub switch_ascii_input_source_in_prefix: bool, } impl Default for KeysConfig { @@ -756,6 +762,23 @@ reveal_hidden_cursor_for_cjk_ime = true } #[test] + fn switch_ascii_input_source_in_prefix_default_off_and_parse() { + let default_config = Config::default(); + assert!( + !default_config + .experimental + .switch_ascii_input_source_in_prefix + ); + + let toml = r#" +[experimental] +switch_ascii_input_source_in_prefix = true +"#; + let config: Config = toml::from_str(toml).unwrap(); + assert!(config.experimental.switch_ascii_input_source_in_prefix); + } + + #[test] fn cjk_ime_cursor_shape_default_steady_block_and_parse() { let default_config = Config::default(); assert_eq!( @@ -1049,11 +1072,13 @@ kitty_graphics = true allow_nested = true kitty_graphics = true pane_history = true +switch_ascii_input_source_in_prefix = true "#; let config: Config = toml::from_str(toml).unwrap(); assert!(config.experimental.allow_nested); assert!(config.experimental.kitty_graphics); assert!(config.experimental.pane_history); + assert!(config.experimental.switch_ascii_input_source_in_prefix); } #[test] |
