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

fix AltGr-7 reporting for win32 input mode

We need to carry the RIGHT_ALT modifier flag through to the win32
input mode encoder so that it is correctly handled by both win32
and wsl apps.

Take care to avoid RIGHT_ALT being encoded as ALT for the
non-win32-input-mode case.

refs: https://github.com/wez/wezterm/issues/2127
refs: https://github.com/wez/wezterm/issues/2098
This commit is contained in:
Wez Furlong 2022-06-18 10:48:07 -07:00
parent 8e16756474
commit e0616e5eb3
2 changed files with 7 additions and 6 deletions

View File

@ -105,9 +105,15 @@ pub fn window_mods_to_termwiz_mods(modifiers: ::window::Modifiers) -> termwiz::i
if modifiers.contains(::window::Modifiers::LEFT_ALT) {
result.insert(termwiz::input::Modifiers::ALT);
}
/* We DONT want to do this: we carry through RIGHT_ALT
* only for win32-input mode to track when AltGr was used,
* but we don't want that to be treated as regular ALT
* when encoding regular input for the terminal.
* <https://github.com/wez/wezterm/issues/2127>
if modifiers.contains(::window::Modifiers::RIGHT_ALT) {
result.insert(termwiz::input::Modifiers::ALT);
}
*/
if modifiers.contains(::window::Modifiers::ALT) {
result.insert(termwiz::input::Modifiers::ALT);
}

View File

@ -2442,12 +2442,7 @@ unsafe fn key(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) -> Option<L
);
match res {
1 => {
// Remove our AltGr placeholder modifier flag now that the
// key press has been expanded.
modifiers.remove(Modifiers::RIGHT_ALT);
Some(KeyCode::Char(std::char::from_u32_unchecked(out[0] as u32)))
}
1 => Some(KeyCode::Char(std::char::from_u32_unchecked(out[0] as u32))),
// No mapping, so use our raw info
0 => {
log::trace!(