From ac2ced20e0881fbe2a68e6ba453baff360136d9a Mon Sep 17 00:00:00 2001 From: Alison Winters Date: Sun, 13 Nov 2022 18:05:46 +0800 Subject: [PATCH] await mode changes triggered by window events --- src/Dispatcher.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Dispatcher.ts b/src/Dispatcher.ts index b12e96c..d58f62c 100644 --- a/src/Dispatcher.ts +++ b/src/Dispatcher.ts @@ -68,18 +68,18 @@ export class Dispatcher { this.disposables.push( window.onDidChangeTextEditorSelection(() => { // Ensure this is executed after all pending commands. - setTimeout(() => { - ActionMode.switchByActiveSelections(this._currentMode.id); + setTimeout(async () => { + await ActionMode.switchByActiveSelections(this._currentMode.id); ActionMoveCursor.updatePreferredColumn(); this._currentMode.onDidChangeTextEditorSelection(); }, 0); }), - window.onDidChangeActiveTextEditor(() => { + window.onDidChangeActiveTextEditor(async () => { if (Configuration.defaultModeID === ModeID.INSERT) { - ActionMode.toInsert(); + await ActionMode.toInsert(); } else { // Passing `null` to `currentMode` to force mode switch. - ActionMode.switchByActiveSelections(null); + await ActionMode.switchByActiveSelections(null); } ActionMoveCursor.updatePreferredColumn(); }),