Fix bug with keymaps flickering in mouse menu (#11795)

Fixes a bug where Vim bindings would flash in the mouse context menu and
then be replaced by the default keybindings. Also fixes those bindings
not being usable while the mouse context menu was open.

Release Notes:

- Fixed bug where Vim bindings were not available when mouse context
menu was open

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Gus
2024-05-14 17:18:21 -06:00
committed by GitHub
co-authored by Conrad Irwin
parent 3da625e538
commit edadc6f938
3 changed files with 17 additions and 6 deletions
+3 -4
View File
@@ -813,12 +813,11 @@ impl Vim {
editor.set_input_enabled(!state.vim_controlled());
editor.set_autoindent(state.should_autoindent());
editor.selections.line_mode = matches!(state.mode, Mode::VisualLine);
if editor.is_focused(cx) {
if editor.is_focused(cx) || editor.mouse_menu_is_focused(cx) {
editor.set_keymap_context_layer::<Self>(state.keymap_context_layer(), cx);
// disables vim if the rename editor is focused,
// but not if the command palette is open.
// disable vim mode if a sub-editor (inline assist, rename, etc.) is focused
} else if editor.focus_handle(cx).contains_focused(cx) {
editor.remove_keymap_context_layer::<Self>(cx)
editor.remove_keymap_context_layer::<Self>(cx);
}
});
}