Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Support extended keys on Mac (F20-F35) (#26899)
0x2CAbf735da3f265
diff --git a/crates/gpui/src/platform/keystroke.rs b/crates/gpui/src/platform/keystroke.rsindex 4af8706ae04..bb16398a350 100644--- a/crates/gpui/src/platform/keystroke.rs+++ b/crates/gpui/src/platform/keystroke.rs@@ -252,6 +252,22 @@ fn is_printable_key(key: &str) -> bool {| "f17"| "f18"| "f19"+ | "f20"+ | "f21"+ | "f22"+ | "f23"+ | "f24"+ | "f25"+ | "f26"+ | "f27"+ | "f28"+ | "f29"+ | "f30"+ | "f31"+ | "f32"+ | "f33"+ | "f34"+ | "f35"| "backspace"| "delete"| "left"diff --git a/crates/gpui/src/platform/mac/events.rs b/crates/gpui/src/platform/mac/events.rsindex 4d2fc12dc15..fafdf0e5372 100644--- a/crates/gpui/src/platform/mac/events.rs+++ b/crates/gpui/src/platform/mac/events.rs@@ -58,6 +58,22 @@ pub fn key_to_native(key: &str) -> Cow<str> {"f17" => NSF17FunctionKey,"f18" => NSF18FunctionKey,"f19" => NSF19FunctionKey,+ "f20" => NSF20FunctionKey,+ "f21" => NSF21FunctionKey,+ "f22" => NSF22FunctionKey,+ "f23" => NSF23FunctionKey,+ "f24" => NSF24FunctionKey,+ "f25" => NSF25FunctionKey,+ "f26" => NSF26FunctionKey,+ "f27" => NSF27FunctionKey,+ "f28" => NSF28FunctionKey,+ "f29" => NSF29FunctionKey,+ "f30" => NSF30FunctionKey,+ "f31" => NSF31FunctionKey,+ "f32" => NSF32FunctionKey,+ "f33" => NSF33FunctionKey,+ "f34" => NSF34FunctionKey,+ "f35" => NSF35FunctionKey,_ => return Cow::Borrowed(key),};Cow::Owned(String::from_utf16(&[code]).unwrap())@@ -332,6 +348,22 @@ unsafe fn parse_keystroke(native_event: id) -> Keystroke {Some(NSF17FunctionKey) => "f17".to_string(),Some(NSF18FunctionKey) => "f18".to_string(),Some(NSF19FunctionKey) => "f19".to_string(),+ Some(NSF20FunctionKey) => "f20".to_string(),+ Some(NSF21FunctionKey) => "f21".to_string(),+ Some(NSF22FunctionKey) => "f22".to_string(),+ Some(NSF23FunctionKey) => "f23".to_string(),+ Some(NSF24FunctionKey) => "f24".to_string(),+ Some(NSF25FunctionKey) => "f25".to_string(),+ Some(NSF26FunctionKey) => "f26".to_string(),+ Some(NSF27FunctionKey) => "f27".to_string(),+ Some(NSF28FunctionKey) => "f28".to_string(),+ Some(NSF29FunctionKey) => "f29".to_string(),+ Some(NSF30FunctionKey) => "f30".to_string(),+ Some(NSF31FunctionKey) => "f31".to_string(),+ Some(NSF32FunctionKey) => "f32".to_string(),+ Some(NSF33FunctionKey) => "f33".to_string(),+ Some(NSF34FunctionKey) => "f34".to_string(),+ Some(NSF35FunctionKey) => "f35".to_string(),_ => {// Cases to test when modifying this://