1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

macos: fix CTRL key behavior when use_ime=true

refs: https://github.com/wez/wezterm/pull/2435
refs: https://github.com/wez/wezterm/issues/2771
refs: https://github.com/wez/wezterm/issues/2630
This commit is contained in:
Wez Furlong 2023-03-30 21:49:48 -07:00
parent 76060b7cc2
commit d1c2257bd8
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
4 changed files with 44 additions and 1 deletions

View File

@ -387,6 +387,9 @@ pub struct Config {
#[dynamic(default = "default_true")]
pub send_composed_key_when_right_alt_is_pressed: bool,
#[dynamic(default = "default_macos_forward_mods")]
pub macos_forward_to_ime_modifier_mask: Modifiers,
#[dynamic(default)]
pub treat_left_ctrlalt_as_altgr: bool,
@ -1909,3 +1912,10 @@ pub(crate) fn validate_domain_name(name: &str) -> Result<(), String> {
Ok(())
}
}
/// <https://github.com/wez/wezterm/pull/2435>
/// <https://github.com/wez/wezterm/issues/2771>
/// <https://github.com/wez/wezterm/issues/2630>
fn default_macos_forward_mods() -> Modifiers {
Modifiers::SHIFT
}

View File

@ -21,6 +21,13 @@ usually the best available version.
As features stabilize some brief notes about them will accumulate here.
#### Changed
* macOS: Japanese IME users: CTRL-modified keys are no long routed to the IME
by default, as it introduced problems with CTRL-key combinations for other users.
A new [macos_forward_to_ime_modifier_mask](config/lua/config/macos_forward_to_ime_modifier_mask.md)
option has been introduced to allow you to control which modifier keys get routed
to the IME, so that you can opt back in to that behavior. #2630 #2771 #2435
#### New
* [pane:activate()](config/lua/pane/activate.md) and [tab:activate()](config/lua/MuxTab/activate.md). #3217
* [ulimit_nofile](config/lua/config/ulimit_nofile.md) and [ulimint_nproc](config/lua/config/ulimit_nproc.md) options. ?3353
@ -46,6 +53,7 @@ As features stabilize some brief notes about them will accumulate here.
respect to the dispatch of the assignment. #3405
* [window:perform_action()](config/lua/window/perform_action.md) now correctly
resolves overlay panes such as Copy Mode. #3209
* macOS: CTRL-Q had to be pressed twice to register when `use_ime=true`. #2630
### 20230326-111934-3666303c

View File

@ -0,0 +1,24 @@
# `macos_forward_to_ime_modifier_mask = "SHIFT"`
{{since('nightly')}}
On macOS systems, this option controls whether modified key presses are
routed via the IME when [use_ime = true](use_ime.md).
When processing a key event, if any modifiers are held, if the modifiers
intersect with the value of `macos_forward_to_ime_modifier_mask`, then the key
event is routed to the IME, which may choose to swallow the key event as
part of its own state management.
The behavior of wezterm has varied in the past:
|Version |Effective Setting|
|-------------------------------------|-----------------|
|20220905-102802-7d4b8249 and earlier | "SHIFT" |
|20221119-145034-49b9839f | "SHIFT|CTRL" |
|nightly | "SHIFT" |
Users of a Japanese IME may wish to set this to `"SHIFT|CTRL"`,
but should note that it will prevent certain CTRL key combinations
that are commonly used in unix terminal programs from working as
expected.

View File

@ -2384,7 +2384,8 @@ impl WindowView {
} else if only_right_alt && !send_composed_key_when_right_alt_is_pressed {
false
} else {
true
modifiers.is_empty()
|| modifiers.intersects(config_handle.macos_forward_to_ime_modifier_mask)
}
};