mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 19:02:07 +00:00
Fix vim mode crash when active editor changes in inactive window
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
parent
c75207c4e5
commit
30f20024c0
1 changed files with 10 additions and 3 deletions
|
@ -9,11 +9,18 @@ pub fn init(cx: &mut AppContext) {
|
|||
}
|
||||
|
||||
fn focused(EditorFocused(editor): &EditorFocused, cx: &mut AppContext) {
|
||||
if let Some(previously_active_editor) = Vim::read(cx).active_editor.clone() {
|
||||
cx.update_window(previously_active_editor.window_id(), |cx| {
|
||||
Vim::update(cx, |vim, cx| {
|
||||
vim.update_active_editor(cx, |previously_active_editor, cx| {
|
||||
Vim::unhook_vim_settings(previously_active_editor, cx);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
cx.update_window(editor.window_id(), |cx| {
|
||||
Vim::update(cx, |vim, cx| {
|
||||
vim.update_active_editor(cx, |previously_active_editor, cx| {
|
||||
Vim::unhook_vim_settings(previously_active_editor, cx);
|
||||
});
|
||||
vim.set_active_editor(editor.clone(), cx);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue