Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix F10 and Alt+F handling on Windows (#24745)
GiM8b088b39850f
diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rsindex 14b34764ae4..2b24403846e 100644--- a/crates/gpui/src/platform/windows/events.rs+++ b/crates/gpui/src/platform/windows/events.rs@@ -1201,14 +1201,23 @@ fn handle_system_theme_changed(fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {let modifiers = current_modifiers();+ let vk_code = wparam.loword();++ // on Windows, F10 can trigger this event, not just the alt key,+ // so when F10 was pressed, handle only itif !modifiers.alt {- // on Windows, F10 can trigger this event, not just the alt key- // and we just don't care about F10- return None;+ if vk_code == VK_F10.0 {+ let offset = vk_code - VK_F1.0;+ return Some(Keystroke {+ modifiers,+ key: format!("f{}", offset + 1),+ key_char: None,+ });+ } else {+ return None;+ }}- let vk_code = wparam.loword();-let key = match VIRTUAL_KEY(vk_code) {VK_BACK => "backspace",VK_RETURN => "enter",@@ -1226,7 +1235,23 @@ fn parse_syskeydown_msg_keystroke(wparam: WPARAM) -> Option<Keystroke> {VK_ESCAPE => "escape",VK_INSERT => "insert",VK_DELETE => "delete",- _ => return basic_vkcode_to_string(vk_code, modifiers),+ _ => {+ let basic_key = basic_vkcode_to_string(vk_code, modifiers);+ if basic_key.is_some() {+ return basic_key;+ } else {+ if vk_code >= VK_F1.0 && vk_code <= VK_F24.0 {+ let offset = vk_code - VK_F1.0;+ return Some(Keystroke {+ modifiers,+ key: format!("f{}", offset + 1),+ key_char: None,+ });+ } else {+ return None;+ }+ }+ }}.to_owned();