While in insert mode, pressing the end key and then the left arrow key makes the cursor jump to a wrong position.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
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:
- Enter insert mode and
- Press the end key to go the end of the line
- Press the left arrow key
- Cursor goes two characters to the left instead of one.
- 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:
- Extension (VsCodeVim) version: v1.26.0
- VSCode version: 1.82.0
- OS: Windows 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in VS Code using insert mode, alternating the End and left-arrow keys as described. Start by tracing the selection-handler and cursor-change behavior shown in the debug output; done means the left arrow moves the cursor exactly one character left after every End press.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100