Avoid re-allocating KeymapContext after every view notification

This commit is contained in:
Antonio Scandurra 2023-05-04 12:04:30 +02:00
parent 18e39ef2fa
commit 3d679ddb26
12 changed files with 74 additions and 75 deletions

View file

@ -309,7 +309,7 @@ impl Vim {
editor.set_input_enabled(!state.vim_controlled());
editor.selections.line_mode = matches!(state.mode, Mode::Visual { line: true });
let context_layer = state.keymap_context_layer();
editor.set_keymap_context_layer::<Self>(context_layer);
editor.set_keymap_context_layer::<Self>(context_layer, cx);
} else {
Self::unhook_vim_settings(editor, cx);
}
@ -321,7 +321,7 @@ impl Vim {
editor.set_clip_at_line_ends(false, cx);
editor.set_input_enabled(true);
editor.selections.line_mode = false;
editor.remove_keymap_context_layer::<Self>();
editor.remove_keymap_context_layer::<Self>(cx);
}
}