Skip to content

Cursor position with Foldfix enabled is broken as of v1.26.0 update #8576

@ktvdev

Description

@ktvdev

Describe the bug
Using "native" keyboard navigation of CTRL+<arrow-key left/right> to jump to beginning end of a word is now broken.

This happens after vim enters a "broken state". If you then jump forward a word using ctrl+right or backward using ctrl+left then try to navigate using left or right, the cursor jumps back to its position before using ctrl+arrow-key. The console reports [warning] Ignoring slipped selection: [n, n; n, n]. Same for using Home or End. Other navigation could also be impacted but I mostly use the ones I mentioned.

Upon further testing VIM appears to enter the "broken state" consistently when moving the cursor between lines of difference length, but only at the end of the line.

Toggling VIM off then on fixes the behavior until navigating over the last character of a foldable region (even if it is unfolded).

Disabling Foldfix resolves the issue as does reverting to v1.25.2 with Foldfix still enabled.

To Reproduce
Steps to reproduce the behavior:

  1. Enable Foldfix ("vim.foldfix": true)
  2. Move cursor up/down between lines of same length = ok
  3. Move cursor up/down between lines of different length but not at the end of the line = ok
  4. Move cursor up/down between lines of different length at the end of the line = enters "broken state"
  5. Notice console log of [warning] invalid cursor position. [n:n | n:n] followed immediately by [warning] Ignoring slipped selection: [n, n; n, n]
  6. Try navigating using ctrl+arrow or home/end
  7. Notice console log of [warning] Ignoring slipped selection: [n, n; n, n] every time you do
  8. Try navigating using arrow-key either left or right
  9. Notice the cursor does not behave as expected
  10. Restart vim using toggleVim then toggleVim again
  11. Perform the same movement using ctrl or home/end followed by left/right
  12. Notice the behavior is back to normal and no warning logs in console

Expected behavior
It's as if the cursor position is not updated properly when in the "broken state" and using ctrl or the other ones.

So if my cursor position is at column 3, then I jump to the end of the next word which puts me at column 10, when I hit right arrow I expect the cursor to move to col 11 but it instead moves to col 4.

Screencasts


Example 1 - Normal behavior then entering "broken state"

ignoring-slipped.mov

Example 2 - Invalid cursor position + Ignoring slipped selection when navigating around bracket (?)

invalid-position.mov

Example 3 - Issue is fixed after restarting VIM (I have alt+v mapped to do this)

fixed-after-toggle.mov

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.26.0
  • VSCode version: 1.82.0
  • OS: Windows, Browser (Vscode.dev)

Additional context
I have not tested this behavior with VIM handling of arrow keys disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions