VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.9k stars 1.32k forks source link

Failed to handle key=<Esc>. Cannot read property 'cursorStartPosition' of undefined #5745

Open thatnerd opened 3 years ago

thatnerd commented 3 years ago

Problem: loses the ability to accept the key.

Environment

To Reproduce

  1. Open VS Code for an existing script.
  2. Type control-v at the start of a line.
  3. Hit j a bunch of times to multi-select the first character of several rows
  4. Hit capital I to go to multi-insert mode
  5. Type # then <space> to enter those characters, then <Esc> to make them appear on each line
    • Note: there was a two-space indent for some, but not all of these lines.
  6. Type u to undo because that's the wrong comment character for typescript
  7. Notice that the first characters of those rows are now selected again.
  8. Type /

Expected result: I input a / character

Actual result:

VSCode complains when I enter any character at this point.

VSCodeVim version: 1.17.1

Stack trace ``` TypeError: Failed to handle key=. Cannot read property 'cursorStartPosition' of undefined at A.exec (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:9:437666) at A.execCount (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:1:37019) at F.runAction (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:9:475409) at F.handleKeyAsAnAction (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:9:474805) at F.handleKeyEvent (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:9:471614) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:94:5) at async Object.promise (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:9:231560) at async Object.runTasks (/Users/will/.vscode/extensions/vscodevim.vim-1.17.1/out/extension.js:9:621914) ```
berknam commented 3 years ago

Environment

* MacOS 10.15.7. Macbook Pro, 15", 2019

* VSCode 1.15.1 with Vim extension.

Do you mean 1.51.1 here?

To Reproduce

1. Open VS Code for an existing script.

2. Type control-v at the start of a line.

3. Hit `j` a bunch of times to multi-select the first character of several rows

4. Hit capital `I` to go to multi-insert mode

5. Type `#` then `<space>` to enter those characters, then `<Esc>` to make them appear on each line

* Note: there was a two-space indent for some, but not all of these lines.

1. Type `u` to undo because that's the wrong comment character for typescript

2. Notice that the first characters of those rows are now selected again.

3. Type `/`

Are you missing a "press I" step here between the undo and pressing "/"?

If I follow your steps exactly by pressing "/" after undo I get a "Failed to handle key=/. Maximum call stack size exceeded" like mentioned here #5844.

But I can't reproduce your error.