message: Always create ModeHandler on task queue, never before enqueueing a task
  This fixes problems where rapid selection changes would cause multiple ModeHandlers to be created for the same TextEditor. Then only some selection changes would be reflected in VimState.
  Fixes
diff: @@ -284,7 +284,7 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
  return;
  }
  - const mh = await getAndUpdateModeHandler();
  + const mh = ModeHandlerMap.get(EditorIdentity.fromEditor(vscode.window.activeTextEditor));
  if (mh === undefined) {
  // We don't care if there is no active editor
  return;
  @@ -350,6 +350,7 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
  context,
  vscode.window.onDidChangeTextEditorVisibleRanges,
  async (e: vscode.TextEditorVisibleRangesChangeEvent) => {
  + taskQueue.enqueueTask(async () => {
  // Scrolling the viewport clears any status bar message, even errors.
  const mh = await getAndUpdateModeHandler();
  if (mh && StatusBar.lastMessageTime) {
  @@ -359,6 +360,7 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
  StatusBar.clear(mh.vimState, true);
  }
  }
  + });
  }
  );
  @@ -497,15 +499,20 @@ export async function activate(context: vscode.ExtensionContext, handleLocal: bo
  for (const boundKey of configuration.boundKeyCombinations) {
  const command = ['<Esc>', '<C-c>'].includes(boundKey.key)
  ? async () => {
  - const didStopRemap = await forceStopRecursiveRemap();
  - if (!didStopRemap) {
  - handleKeyEvent(`${boundKey.key}`);
  + const mh = await getAndUpdateModeHandler();
  + if (mh && !(await forceStopRecursiveRemap(mh))) {
  + await mh.handleKeyEvent(`${boundKey.key}`);
  }
  }
  - : () => {
  - handleKeyEvent(`${boundKey.key}`);
  + : async () => {
  + const mh = await getAndUpdateModeHandler();
  + if (mh) {
  + await mh.handleKeyEvent(`${boundKey.key}`);
  + }
  };
  - registerCommand(context, boundKey.command, command);
  + registerCommand(context, boundKey.command, async () => {
  + taskQueue.enqueueTask(command);
  + });
  }
  {
  @@ -625,21 +632,11 @@ function registerEventListener<T>(
  context.subscriptions.push(disposable);
  }
  -async function handleKeyEvent(key: string): Promise<void> {
  - const mh = await getAndUpdateModeHandler();
  - if (mh) {
  - taskQueue.enqueueTask(async () => {
  - await mh.handleKeyEvent(key);
  - });
  - }
  -}
  -
  /**
  * @returns true if there was a remap being executed to stop
  */
  -async function forceStopRecursiveRemap(): Promise<boolean> {
  - const mh = await getAndUpdateModeHandler();
  - if (mh?.remapState.isCurrentlyPerformingRecursiveRemapping) {
  +async function forceStopRecursiveRemap(mh: ModeHandler): Promise<boolean> {
  + if (mh.remapState.isCurrentlyPerformingRecursiveRemapping) {
  mh.remapState.forceStopRecursiveRemapping = true;
  return true;
  }
  