Skip to content

Commit

Permalink
await mode changes triggered by window events
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonatwork committed Nov 13, 2022
1 parent 9faafbe commit ac2ced2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down

0 comments on commit ac2ced2

Please sign in to comment.