Skip to content

Commit

Permalink
outline_panel: Fix j and k not working in outline panel filter (z…
Browse files Browse the repository at this point in the history
…ed-industries#17293)

Closes zed-industries#17248

Release Notes:

- Fixed outline panel filter not working for certain Vim bindings
([zed-industries#17248](zed-industries#17248))
  • Loading branch information
CharlesChen0823 authored and osiewicz committed Sep 5, 2024
1 parent 6011a4d commit aecb2ef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/keymaps/default-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@
}
},
{
"context": "OutlinePanel",
"context": "OutlinePanel && not_editing",
"bindings": {
"escape": "menu::Cancel",
"left": "outline_panel::CollapseSelectedEntry",
Expand Down
2 changes: 1 addition & 1 deletion assets/keymaps/default-macos.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
}
},
{
"context": "OutlinePanel",
"context": "OutlinePanel && not_editing",
"bindings": {
"escape": "menu::Cancel",
"left": "outline_panel::CollapseSelectedEntry",
Expand Down
2 changes: 1 addition & 1 deletion assets/keymaps/vim.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
}
},
{
"context": "OutlinePanel",
"context": "OutlinePanel && not_editing",
"bindings": {
"j": "menu::SelectNext",
"k": "menu::SelectPrev",
Expand Down
8 changes: 7 additions & 1 deletion crates/outline_panel/src/outline_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit aecb2ef

Please sign in to comment.