Cursor jumps to the beginning of the file after switching from another one
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
Sometimes, after switching from one file to another (through tabs), pressing a key makes the cursor jump to the beginning of the file.
To Reproduce
I haven't found yet what's triggering the issue. However, once it happens, it can be reproduced like this:
- One a file editor, move away from the beginning of the file (row 0, column 0, if you are there), either with the keyboard or with the mouse. For example, press
jto move down one line. - Switch to another file tab with the keyboard or mouse.
- Switch back to the previous file.
- Pressing any key (Esc included) but modifiers (Ctrl, Alt...) jumps to the beginning.
- Closing and reopening the file fixes it.
Expected behavior
The cursor should remain in the same position.
Environment (please complete the following information):
- Extension (VsCodeVim) version: 1.24.3
- VSCode version: 1.74.2
- OS: Linux
Additional context
This issue appeared after the upgrade to VS Code 1.74, so it may be related to #8157, although a file affected by the former might not be by the latter.
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
Start by reproducing the tab-switching sequence described in the issue on the stated VS Code and VsCodeVim versions. Trace the extension's handling of editor changes, cursor restoration, and key events to identify why the first key resets the cursor; done means the cursor remains in its prior position after switching tabs and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100