Initialize the active editor when vim mode is enabled

Instead of waiting for a focus event. This makes more tests pass.
This commit is contained in:
Antonio Scandurra
2023-04-20 14:02:40 -06:00
committed by Nathan Sobo
parent 0d5eea8169
commit 137d9384b5
11 changed files with 127 additions and 116 deletions
+3 -3
View File
@@ -3,10 +3,10 @@ use editor::{
char_kind, display_map::DisplaySnapshot, movement, scroll::autoscroll::Autoscroll, CharKind,
DisplayPoint,
};
use gpui::AppContext;
use gpui::WindowContext;
use language::Selection;
pub fn change_motion(vim: &mut Vim, motion: Motion, times: usize, cx: &mut AppContext) {
pub fn change_motion(vim: &mut Vim, motion: Motion, times: usize, cx: &mut WindowContext) {
// Some motions ignore failure when switching to normal mode
let mut motion_succeeded = matches!(
motion,
@@ -38,7 +38,7 @@ pub fn change_motion(vim: &mut Vim, motion: Motion, times: usize, cx: &mut AppCo
}
}
pub fn change_object(vim: &mut Vim, object: Object, around: bool, cx: &mut AppContext) {
pub fn change_object(vim: &mut Vim, object: Object, around: bool, cx: &mut WindowContext) {
let mut objects_found = false;
vim.update_active_editor(cx, |editor, cx| {
// We are swapping to insert mode anyway. Just set the line end clipping behavior now