Vim: It is possible to scroll the cursor out of screen

Created on 21 Jun 2019  路  3Comments  路  Source: VSCodeVim/Vim

Describe the bug
Unlike with vi and vim, with vscodevim it is possible to scroll the insertion point out of the screen.
As vim comes from vi which was a terminal text editor, the cursor was always "there".
GUIs allow the cursor to go out of sight, but IMO this is not a Good Thing.

To Reproduce

  1. Open a file with more lines that the viewport height
  2. Click on one of the first lines
  3. Scroll down, more than one page
  4. Notice that the insertion point is not visible.
  5. Type a space and see how the text scrolls in an unexpected fashion.

Expected behavior
1- When scrolling down the cursor stays in the line it was initially, same column (as now)
2- When the line that contains the cursor reaches the top of the screen, the cursor stays in that top line
3- When scrolling back a few lines the cursor stays in the line it is as it moves down
4- With back scroll the behavior is symmetric
5- Scrolling does not change the column the cursor "wants" to be

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.8.1 with neovim enabled
  • VSCode version: Version: 1.35.1
    Commit: c7d83e57cd18f18026a8162d042843bda1bcf21f
    Date: 2019-06-12T14:27:31.086Z
    Electron: 3.1.8
    Chrome: 66.0.3359.181
    Node.js: 10.2.0
    V8: 6.6.346.32
    OS: Linux x64 5.0.0-16-generic
  • OS:

Additional context
Vim always has an integer number of lines, and it's not possible to scroll a line partially.
I bring this up here because it might be related to this bug.
These are ingredients of the Full Vim Experience.

Most helpful comment

Hello @juanlanus, this is a Vim _emulator_. The way the VS Code editor works is completely different than actual Vim. The cursor does not stay in view when you scroll, like it does in Vim. That is a Vim-only feature.

It is certainly possible to implement such emulation, though I expect this doesn't bug most people enough for them to make the contribution. If you implemented, that would be cool!

I my self actually like my cursor staying exactly where is in the text file while I scroll. This makes it easy to jump right back to that same spot by moving the cursor by one character. I never liked the feature of Vim that keeps the cursor in view, and I actually like that emulators allow us to scroll without losing our position.

All 3 comments

Hello @juanlanus, this is a Vim _emulator_. The way the VS Code editor works is completely different than actual Vim. The cursor does not stay in view when you scroll, like it does in Vim. That is a Vim-only feature.

It is certainly possible to implement such emulation, though I expect this doesn't bug most people enough for them to make the contribution. If you implemented, that would be cool!

I my self actually like my cursor staying exactly where is in the text file while I scroll. This makes it easy to jump right back to that same spot by moving the cursor by one character. I never liked the feature of Vim that keeps the cursor in view, and I actually like that emulators allow us to scroll without losing our position.

This has been discussed before; see #873.

Closing in favor of #873

Was this page helpful?
0 / 5 - 0 ratings