Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Fix incorrect handling of Function key modifier on macOS (#38518)

Cyandev2664596a34a2
diff --git a/crates/gpui/src/platform/keystroke.rs b/crates/gpui/src/platform/keystroke.rs
index 4a2bfc785e3..e1f1b0c9fbb 100644
--- a/crates/gpui/src/platform/keystroke.rs
+++ b/crates/gpui/src/platform/keystroke.rs
@@ -572,6 +572,14 @@ impl Modifiers {
}
}
+ /// Returns [`Modifiers`] with just function.
+ pub fn function() -> Modifiers {
+ Modifiers {
+ function: true,
+ ..Default::default()
+ }
+ }
+
/// Returns [`Modifiers`] with command + shift.
pub fn command_shift() -> Modifiers {
Modifiers {
diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs
index 9c56d24e685..11ea4fb7e27 100644
--- a/crates/gpui/src/platform/mac/window.rs
+++ b/crates/gpui/src/platform/mac/window.rs
@@ -1753,9 +1753,9 @@ extern "C" fn handle_key_event(this: &Object, native_event: id, key_equivalent:
}
}
- // Don't send key equivalents to the input handler,
- // or macOS shortcuts like cmd-` will stop working.
- if key_equivalent {
+ // Don't send key equivalents to the input handler if there are key modifiers other
+ // than Function key, or macOS shortcuts like cmd-` will stop working.
+ if key_equivalent && key_down_event.keystroke.modifiers != Modifiers::function() {
return NO;
}