VSCodeVim / Vim

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

While in insert mode, pressing the end key and then the left arrow key makes the cursor jump to a wrong position. #8585

Open jaoreir opened 1 year ago

jaoreir commented 1 year ago

Describe the bug Using the left arrow key after pressing END in insert mode makes the cursor move two characters to the left instead of one every other time. Sometimes it jumps to even further left, but I do not have a way to reproduce it reliably.

To Reproduce Steps to reproduce the behavior:

  1. Enter insert mode and
  2. Press the end key to go the end of the line
  3. Press the left arrow key
  4. Cursor goes two characters to the left instead of one.
  5. Repeatedly press the end and left arrow key to see that the bug happens every other time.

Expected behavior Cursor goes one character to the left every time the left arrow key is pressed.

Screenshots

Video: Alternating between pressing END and left arrow:

https://github.com/VSCodeVim/Vim/assets/37289650/3d38e96a-edc2-451c-9c27-114c1afbba14

Vim's output in debug mode when alternating between END and left arrow:

2023-09-12 19:18:29.678 [debug] Selection change: [0, 18], [0, 18], SelectionsLength: 1
2023-09-12 19:18:29.679 [debug] Selections: Changing Cursors from selection handler... [0, 18], [0, 18]
2023-09-12 19:18:29.784 [debug] Handling key: <left>
2023-09-12 19:18:29.918 [debug] Selection change: [0, 18], [0, 18], SelectionsLength: 1
2023-09-12 19:18:30.008 [debug] Handling key: <left>
2023-09-12 19:18:30.151 [debug] Selection change: [0, 18], [0, 18], SelectionsLength: 1
2023-09-12 19:18:30.151 [debug] Selections: Changing Cursors from selection handler... [0, 18], [0, 18]
2023-09-12 19:18:30.234 [debug] Handling key: <left>
2023-09-12 19:18:30.384 [debug] Selection change: [0, 18], [0, 18], SelectionsLength: 1
2023-09-12 19:18:30.473 [debug] Handling key: <left>
2023-09-12 19:18:30.624 [debug] Selection change: [0, 18], [0, 18], SelectionsLength: 1
2023-09-12 19:18:30.624 [debug] Selections: Changing Cursors from selection handler... [0, 18], [0, 18]
2023-09-12 19:18:30.728 [debug] Handling key: <left>
2023-09-12 19:18:30.864 [debug] Selection change: [0, 18], [0, 18], SelectionsLength: 1
2023-09-12 19:18:30.953 [debug] Handling key: <left>

The end key seems to only trigger "Changing Cursors from selection handler" every other time. When that is triggered, the cursor moves correctly on the next left arrow key press. If it doesn't, the cursor jumps two characters instead.

Environment:

vann-at-cpcp-dot-tw commented 1 year ago

Same here

Environment: Extension (VsCodeVim) version: v1.26.0 VSCode version: 1.82.2 OS: macOS 13.5.2

ywj0623 commented 1 year ago

Same here

Environment: Extension (VsCodeVim) version: v1.26.0 VSCode version: 1.78.2 OS: macOS 13.2

hannesweisbach commented 9 months ago

Same here

Extension version: 1.27.2 VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:47:11.635Z) OS version: Linux x64 6.5.0-14-generic snap

TeamDman commented 4 days ago

Same here

Version: 1.94.2 (user setup)
Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
Date: 2024-10-09T16:08:44.566Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

Name: Vim
Id: vscodevim.vim
Description: Vim emulation for Visual Studio Code
Version: 1.28.1
Publisher: vscodevim
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=vscodevim.vim