diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index 107d6e84f0..6f044c0f71 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -521,7 +521,7 @@ } }, { - "context": "OutlinePanel", + "context": "OutlinePanel && not_editing", "bindings": { "escape": "menu::Cancel", "left": "outline_panel::CollapseSelectedEntry", diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index 752a05cbee..5ebd3d0ccd 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -528,7 +528,7 @@ } }, { - "context": "OutlinePanel", + "context": "OutlinePanel && not_editing", "bindings": { "escape": "menu::Cancel", "left": "outline_panel::CollapseSelectedEntry", diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 9e6dfdb720..37a3ee0780 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -489,7 +489,7 @@ } }, { - "context": "OutlinePanel", + "context": "OutlinePanel && not_editing", "bindings": { "j": "menu::SelectNext", "k": "menu::SelectPrev", diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index 18629f57bf..6605426d59 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -722,10 +722,16 @@ impl OutlinePanel { ); } - fn dispatch_context(&self, _: &ViewContext) -> KeyContext { + fn dispatch_context(&self, cx: &ViewContext) -> 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 }