Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix use_ime=true swallows keys with LEADER modifier in macOS #1410

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion wezterm-input-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,23 @@ fn normalize_shift(key: KeyCode, modifiers: Modifiers) -> (KeyCode, Modifiers) {
_ => (key, modifiers),
}
} else {
(key, modifiers)
match key {
// when use_ime=true, destructuring composed key to get the string and return the first character when
// it's one character long for searching in key map.
KeyCode::Composed(s) => {
let mut char_iter = s.chars();
if let Some(first_char) = char_iter.next() {
if char_iter.next().is_none() {
(KeyCode::Char(first_char), modifiers - Modifiers::SHIFT)
} else {
(KeyCode::Composed(s.clone()), modifiers)
}
} else {
(KeyCode::Composed(s.clone()), modifiers)
}
}
_ => (key, modifiers),
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion window/src/os/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,8 @@ impl WindowView {
"\x08"
} else if virtual_key == super::keycodes::kVK_Tab {
"\t"
} else if !use_ime && virtual_key == super::keycodes::kVK_Delete {
} else if virtual_key == super::keycodes::kVK_Delete {
// When using IME in macOS, delete applied in candidate window.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a different issue from the main thing you mentioned in #1409; could you give some more details on how to reproduce the issue that you're fixing with this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see now; I'll fix this in a commit I have in progress!

"\x08"
} else if virtual_key == super::keycodes::kVK_ANSI_KeypadEnter {
// https://github.com/wez/wezterm/issues/739
Expand Down