Ignoring slipped selection after scrolling down extremely fast
Describe the bug When scrolling down a file extremely fast the extension will go into a state where searching will give a ignoring slipped selection warning, and the cursor will jump back to its original position after pressing escape twice.
To Reproduce
- Add a mapping to move down fast. For example:
nnoremap J 10j
Though I managed to trigger this with 1j as well. Simply using j on the other hand does not trigger it.
2. Go to a file that does not fit on a single page. Two screens long should be enough to trigger the bug.
3. Scroll down by holding down the mapped key. Note that I have my Windows modified for rapid repeated keys. I'm not sure if that is necessary to trigger this, or if the normal repeated key interval will suffice.
4. Press Ctrl + F for search.
5. Search anything away from where your cursor is currently at.
6. Press escape twice.
7. The cursor jumps back to its old position.
When you search a warning triggers: Ignoring slipped selection: [49, 51; 49, 52] appear.
Expected behavior When pressing escape twice I expect my cursor to stay in the position where it was placed as a result of searching.
Screenshots
Searching for b and then pressing escape twice.
Environment (please complete the following information):
- Extension (VsCodeVim) version: V1.27.3
- VSCode version: 1.91.1
- OS: Windows 10
Additional context This is a terrible type of bug, because it makes me distrust my editor. Every time I press escape after a search I need to hope that it will not jump back. If anyone has a quick fix for me, that would also be great.
I have this too, specifically when doing jump to errors/problems. The screen will suddenly jump to the top of the file or change some random line that isn't my current one. The only fix I have found is to close VSCode and reopen it.
Found a hacky fix.
I don't like <C-d> and <C-u> adding new entries to jumplist. A new entry just happens on the jumplist if you move more than 10 lines at the same time, to avoid this I was using nnoremap <C-d> 9j9j4j but then started having the same reported bug.
I noticed that the problem doesn't happen when using the vscode cursorMove command. And it's possible to use "runCommands" to execute multiple at the same time:
{
"key": "ctrl+d",
"command": "runCommands",
"args": {
"commands": [
{ "command": "cursorMove", "args": { "to": "down", "by": "line", "value": 9, "revealCursor": true } },
{ "command": "cursorMove", "args": { "to": "down", "by": "line", "value": 9, "revealCursor": true } },
{ "command": "cursorMove", "args": { "to": "down", "by": "line", "value": 4, "revealCursor": true } }
]
},
"when": "editorTextFocus && vim.active"
},
{
"key": "ctrl+u",
"command": "runCommands",
"args": {
"commands": [
{ "command": "cursorMove", "args": { "to": "up", "by": "line", "value": 9, "revealCursor": true } },
{ "command": "cursorMove", "args": { "to": "up", "by": "line", "value": 9, "revealCursor": true } },
{ "command": "cursorMove", "args": { "to": "up", "by": "line", "value": 4, "revealCursor": true } }
]
},
"when": "editorTextFocus && vim.active"
}
It's not perfect though, I noticed that if I go to the end of file and press <C-d>, it'll go to an invalid position of the buffer, if you leave and go back to the buffer, "slipped selection" will happen again.