window: fix CTRL+C with Russian keyboard on windows

Turns out that we had the same issue on Windows

refs: #678
This commit is contained in:
Wez Furlong committed 2022-01-02 16:50:26 -07:00
1 parent ea964e74e3
commit 2d62bffe41
2 files changed
+28 -10

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ As features stabilize some brief notes about them will accumulate here.
#### Fixed
* Regression that broke fontconfig aliases such as `"monospace"` [#1250](https://github.com/wez/wezterm/pull/1250)
* X11/Wayland: CTRL+C in non-latin keyboard layouts wouldn't send CTRL-C [#678](https://github.com/wez/wezterm/issues/678)
* Windows/X11/Wayland: CTRL+C in non-latin keyboard layouts wouldn't send CTRL-C [#678](https://github.com/wez/wezterm/issues/678)
### 20220101-133340-7edc5b5a
+27 -9
View File
@@ -1978,15 +1978,33 @@ unsafe fn key(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) -> Option<L
if let Some(key) = key {
let is_composed = raw != Some(key.clone()) || modifiers != raw_modifiers;
let key = KeyEvent {
key,
raw_key: if is_composed { raw } else { None },
raw_modifiers,
raw_code: Some(wparam as u32),
phys_code,
modifiers,
repeat_count: repeat,
key_is_down: !releasing,
// Urgh, special case for ctrl and non-latin layouts.
// In order to avoid a situation like #678, if CTRL is the only
// modifier and we've got composed text, then discard the composed
// text.
let key = if is_composed && modifiers == Modifiers::CTRL && raw.is_some() {
KeyEvent {
key: raw.unwrap(),
raw_key: None,
raw_modifiers,
raw_code: Some(wparam as u32),
phys_code,
modifiers,
repeat_count: repeat,
key_is_down: !releasing,
}
} else {
KeyEvent {
key,
raw_key: if is_composed { raw } else { None },
raw_modifiers,
raw_code: Some(wparam as u32),
phys_code,
modifiers,
repeat_count: repeat,
key_is_down: !releasing,
}
}
.normalize_shift();