1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

windows: make repeated dead key handling consistent with other apps

On Windows in FRA layout, `^^SPACE` results in `^^SPACE`, whereas
on Linux it results in `^SPACE`.  We were doing the latter instead
of the former.

Let's just be consistent with other windows apps.

closes: #1729
closes: #1730
This commit is contained in:
Wez Furlong 2022-03-18 10:42:14 -07:00
parent 37d2b04af6
commit 8c3d2f6eb6

View File

@ -1875,21 +1875,28 @@ unsafe fn key(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) -> Option<L
.normalize_shift()
.normalize_ctrl();
inner.events.dispatch(WindowEvent::KeyEvent(key));
inner.events.dispatch(WindowEvent::KeyEvent(key.clone()));
// And then we'll perform normal processing on the
// current key press
if inner
.keyboard_info
.is_dead_key_leader(modifiers, vk)
.is_some()
if let Some(new_dead_char) =
inner.keyboard_info.is_dead_key_leader(modifiers, vk)
{
// Happens to be the start of its own new
// dead key sequence
if new_dead_char != c {
// Happens to be the start of its own new,
// different, dead key sequence
inner.dead_pending.replace((modifiers, vk));
return Some(0);
}
// They pressed the same dead key twice,
// emit the underlying char again and call
// it done.
// <https://github.com/wez/wezterm/issues/1729>
inner.events.dispatch(WindowEvent::KeyEvent(key.clone()));
return Some(0);
}
// We don't know; allow normal ToUnicode processing
None
}