VSCodeVim / Vim

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

`<Esc>` after creation of a new auto-indented line in insert mode does not remove whitespace #3515

Open davea1 opened 5 years ago

davea1 commented 5 years ago

Describe the bug

While typing text in insert mode with the Auto Indent setting enabled, Esc immediately following the creation of a new auto-indented line (via Enter/Return) will leave behind whitespace.

With Vim, all such whitespace is removed as soon as Esc is hit, leaving only a blank line.

To Reproduce

While in insert mode with the Auto Indent setting enabled, type the following:

this
<tab>is
a
test
<esc>

Expected behavior

Vim result:

this
    is
    a
    test
|

Unexpected VSCodeVim result:

this
    is
    a
    test
   |

Environment (please complete the following information):

Additional context

Behavior appears to be correct with regard to new lines created via O or o, but not with regard to basic text entry while in insert mode.

Related to issue: #2693

davea1 commented 5 years ago

Update: This deviation from proper Vim emulation only appears to exist when the Language Mode is set to Plain Text. Whenever the Language Mode is set to a coding language (e.g. C or C++), emulation of Vim appears to be correct.