1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

macos: revise how we prevent routing to the IME

https://github.com/wez/wezterm/pull/2435 proposed including
CTRL-modified keys, but I think that the state of the code now means
that we can simplify that area and adjust it so that we will default to
routing keys to the IME, but excluding them based on the
`send_composed_key_when_(left|right)_alt_is_pressed` configuration.

I've only very lightly tested this, but it seems ok with roman text and
me punching in random pinyin and then using CTRL-H or CTRL-M to delete
or enter.

refs: https://github.com/wez/wezterm/pull/2435
This commit is contained in:
Wez Furlong 2022-09-21 21:22:38 -07:00
parent dc9fb118ec
commit 694ffdbed2
2 changed files with 6 additions and 5 deletions

View File

@ -67,6 +67,8 @@ As features stabilize some brief notes about them will accumulate here.
* `tab:panes()` and `tab:panes_with_info()` now return the full list of panes
in the tab regardless of whether a pane was zoomed. Previously, if a pane was
zoomed, only that pane would be returned by those methods.
* macOS: CTRL-modified keys are now routed to the IME
[#2435](https://github.com/wez/wezterm/pull/2435)
#### Updated
* Bundled Nerd Font Symbols font to v2.2.2

View File

@ -1597,6 +1597,8 @@ impl WindowView {
| "moveUpAndModifySelection:"
| "moveDown:"
| "moveDownAndModifySelection:"
| "moveToBeginningOfParagraph:"
| "moveToEndOfParagraph:"
| "insertTab:"
| "insertBacktab:"
| "insertNewline:"
@ -2226,21 +2228,18 @@ impl WindowView {
};
let alt_mods = Modifiers::LEFT_ALT | Modifiers::RIGHT_ALT | Modifiers::ALT;
let only_alt = (modifiers & alt_mods) == Modifiers::ALT;
let only_left_alt = (modifiers & alt_mods) == (Modifiers::LEFT_ALT | Modifiers::ALT);
let only_right_alt = (modifiers & alt_mods) == (Modifiers::RIGHT_ALT | Modifiers::ALT);
// Also respect `send_composed_key_when_(left|right)_alt_is_pressed` configs
// when `use_ime` is true.
let forward_to_ime = {
if modifiers.is_empty() || modifiers == Modifiers::SHIFT {
true
} else if only_left_alt && !send_composed_key_when_left_alt_is_pressed {
if only_left_alt && !send_composed_key_when_left_alt_is_pressed {
false
} else if only_right_alt && !send_composed_key_when_right_alt_is_pressed {
false
} else {
only_alt
true
}
};