vim: Use explicit global, not default (#2987)

This should have no user-visible impact, but tidies up one of the
awkwardnesses
of how vim uses global state at the moment.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Conrad Irwin 2023-09-19 20:52:25 -06:00 committed by GitHub
commit 1295e5b41f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -40,6 +40,7 @@ fn blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut AppContext) {
if previous_editor == editor.clone() {
vim.clear_operator(cx);
vim.active_editor = None;
vim.editor_subscription = None;
}
}
@ -50,10 +51,11 @@ fn blurred(EditorBlurred(editor): &EditorBlurred, cx: &mut AppContext) {
fn released(EditorReleased(editor): &EditorReleased, cx: &mut AppContext) {
editor.window().update(cx, |cx| {
cx.update_default_global(|vim: &mut Vim, _| {
Vim::update(cx, |vim, _| {
if let Some(previous_editor) = vim.active_editor.clone() {
if previous_editor == editor.clone() {
vim.active_editor = None;
vim.editor_subscription = None;
}
}
vim.editor_states.remove(&editor.id())