outline_panel: Fix j and k not working in outline panel filter (#17293)

Closes #17248

Release Notes:

- Fixed outline panel filter not working for certain Vim bindings
([#17248](https://github.com/zed-industries/zed/issues/17248))
This commit is contained in:
CharlesChen0823 2024-09-04 17:27:07 +08:00 committed by GitHub
parent 5b0d64890f
commit 072513f59f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 4 deletions

View File

@ -521,7 +521,7 @@
}
},
{
"context": "OutlinePanel",
"context": "OutlinePanel && not_editing",
"bindings": {
"escape": "menu::Cancel",
"left": "outline_panel::CollapseSelectedEntry",

View File

@ -528,7 +528,7 @@
}
},
{
"context": "OutlinePanel",
"context": "OutlinePanel && not_editing",
"bindings": {
"escape": "menu::Cancel",
"left": "outline_panel::CollapseSelectedEntry",

View File

@ -489,7 +489,7 @@
}
},
{
"context": "OutlinePanel",
"context": "OutlinePanel && not_editing",
"bindings": {
"j": "menu::SelectNext",
"k": "menu::SelectPrev",

View File

@ -722,10 +722,16 @@ impl OutlinePanel {
);
}
fn dispatch_context(&self, _: &ViewContext<Self>) -> KeyContext {
fn dispatch_context(&self, cx: &ViewContext<Self>) -> KeyContext {
let mut dispatch_context = KeyContext::new_with_defaults();
dispatch_context.add("OutlinePanel");
dispatch_context.add("menu");
let identifier = if self.filter_editor.focus_handle(cx).is_focused(cx) {
"editing"
} else {
"not_editing"
};
dispatch_context.add(identifier);
dispatch_context
}