Ensure the candidate keybinding matches the correct context

Marshall Bowers created

Change summary

crates/gpui2/src/key_dispatch.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Detailed changes

crates/gpui2/src/key_dispatch.rs 🔗

@@ -167,7 +167,10 @@ impl DispatchTree {
         self.keymap
             .lock()
             .bindings_for_action(action.type_id())
-            .filter(|candidate| candidate.action.partial_eq(action))
+            .filter(|candidate| {
+                candidate.action.partial_eq(action)
+                    && candidate.matches_context(&self.context_stack)
+            })
             .cloned()
             .collect()
     }