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.

keymap_ui: Fix bug introduced in #35208 (#35237)

Ben Kunklefa6b1a011406
diff --git a/crates/gpui/src/platform/keystroke.rs b/crates/gpui/src/platform/keystroke.rs
index 0f8dbdf9d2b..24601eefd6d 100644
--- a/crates/gpui/src/platform/keystroke.rs
+++ b/crates/gpui/src/platform/keystroke.rs
@@ -534,11 +534,7 @@ impl Modifiers {
/// Checks if this [`Modifiers`] is a subset of another [`Modifiers`].
pub fn is_subset_of(&self, other: &Modifiers) -> bool {
- (other.control || !self.control)
- && (other.alt || !self.alt)
- && (other.shift || !self.shift)
- && (other.platform || !self.platform)
- && (other.function || !self.function)
+ (*other & *self) == *self
}
}
diff --git a/crates/settings_ui/src/keybindings.rs b/crates/settings_ui/src/keybindings.rs
index 667483a434b..5ff91246f4d 100644
--- a/crates/settings_ui/src/keybindings.rs
+++ b/crates/settings_ui/src/keybindings.rs
@@ -3114,7 +3114,9 @@ impl KeystrokeInput {
) {
let keystrokes_len = self.keystrokes.len();
- if event.modifiers.is_subset_of(&self.previous_modifiers) {
+ if self.previous_modifiers.modified()
+ && event.modifiers.is_subset_of(&self.previous_modifiers)
+ {
self.previous_modifiers &= event.modifiers;
cx.stop_propagation();
return;