Use correct context path for focused element in WindowContext::bindings_for_action (#18843)

Previously, we were reaching in and using the context_stack on the dispatch tree, which was incorrect.

/cc @as-cii 
/cc @ConradIrwin

Release Notes:

- N/A

---------

Co-authored-by: Michael Sloan <michael@zed.dev>
This commit is contained in:
Nathan Sobo 2024-11-05 16:42:50 -07:00 committed by GitHub
parent 7931342455
commit e47b305ca7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 34 deletions

View file

@ -106,7 +106,7 @@ impl Keymap {
pub fn bindings_for_input(
&self,
input: &[Keystroke],
context_stack: &[KeyContext],
context_path: &[KeyContext],
) -> (SmallVec<[KeyBinding; 1]>, bool) {
let possibilities = self.bindings().rev().filter_map(|binding| {
binding
@ -118,8 +118,8 @@ impl Keymap {
let mut is_pending = None;
'outer: for (binding, pending) in possibilities {
for depth in (0..=context_stack.len()).rev() {
if self.binding_enabled(binding, &context_stack[0..depth]) {
for depth in (0..=context_path.len()).rev() {
if self.binding_enabled(binding, &context_path[0..depth]) {
if is_pending.is_none() {
is_pending = Some(pending);
}