Skip to content

[Bug]: vscode-neovim cursor jumps to first row after entering a directory with preview open #58

@corwinm

Description

@corwinm

Reproduction

  1. Install and enable vscode-neovim.
  2. Open an oil buffer.
  3. Open preview for the selected entry.
  4. Enter a directory from the oil buffer.
  5. Press j using vscode-neovim to move down one row.

Actual behavior

The cursor jumps/snaps back to the first row instead of staying on the newly selected row.

Expected behavior

The cursor should move down one row normally.

Scope / current findings

  • Reproduces with vscode-neovim.
  • Does not reproduce with arrow keys.
  • Does not reproduce with VSCodeVim.
  • This appears to be pre-existing rather than caused by the recent previewByDefault work.
  • The issue is specifically tied to oil buffers with preview enabled after directory navigation.

Notes from investigation

  • We removed a delayed cursor reset in src/commands/select.ts on the "enter directory" path because it could race with real user movement.
  • We also fixed src/decorations.ts so hidden-prefix correction no longer forces the cursor to line 0.
  • After those fixes, the general extension tests pass and normal VS Code / VSCodeVim movement behave correctly.
  • The remaining bad behavior looks specific to the timing/order of selection updates coming from vscode-neovim.

Likely areas to revisit

  • src/decorations.ts
    • hidden prefix correction in onDidChangeTextEditorSelection
    • any cursor mutation during decoration updates
  • src/commands/select.ts
    • post-navigation cursor placement when entering directories
  • possible interaction with vscode-neovim cursor synchronization timing

Environment observed during investigation

  • branch: feat/file-preview-by-default
  • commit: db4330e3c08da76d909368690134ea03b81df17a
  • oil.code workspace tests were passing at the time of filing

Follow-up

When revisiting this, it would be useful to capture the exact sequence of VS Code selection events vs vscode-neovim cursor updates while moving from row 0 to row 1 in a freshly opened oil directory buffer with preview enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions