Skip to content

fix(jump): ensure one non-jump movement is enough to stop jumping#2335

Closed
abeldekat wants to merge 2 commits intonvim-mini:mainfrom
abeldekat:jump_ensure_stop
Closed

fix(jump): ensure one non-jump movement is enough to stop jumping#2335
abeldekat wants to merge 2 commits intonvim-mini:mainfrom
abeldekat:jump_ensure_stop

Conversation

@abeldekat
Copy link
Copy Markdown
Member

Details:

  • When the state is jumping, but there was no jump, two non-jump
    movements are needed to stop jumping.
    This can happen when the jump is not possible and there are targets
    in the other direction.

Scenario with file containing a single word:

mark

With cursor on a:

  • type fm
  • wait for highlight
  • type l and it still highlights
  • l and it stops highlighting.

Cause: State is in jumping mode, but there was no jump, and thus no CursorMoved

This PR builds upon the commit proposed in #2332: fix(jump): do not force charwise Operator-pending jump#2332

Details:
- Highlight matches even when the Operator-pending jump did
  not succeed. This can happen if the jump is not possible,
  but there are matches in the other direction.

- The internal `undo` workaround is not needed anymore.

Resolve nvim-mini#2323
Details:
- When the state is jumping, but there was no jump, two non-jump
  movements are needed to stop jumping.
  This can happen when the jump is not possible and there are targets
  in the other direction.
@abeldekat abeldekat marked this pull request as draft March 30, 2026 18:25
@echasnovski
Copy link
Copy Markdown
Member

Thanks for the PR!

The change looks reasonable. I've applied the relevant commit manually and tweaked a test case a bit (see 90c402e). What I've come to realize (some time after writing all 'mini.jump' tests) is that validating conditions inside a for loop for different cases is not really convenient in the long term. If something fails, it might be hard to figure out which case broke since traceback will point to a line inside a loop. So (at least for now) writing a single validate() helper and then calling it on separate lines for different inputs is the preferred approach.

Another approach would be to have parametrized tests, of course, but it will inflate the number of test cases without much profit. It should be preferred if resetting to a clean state is either very hard or impossible.

@abeldekat
Copy link
Copy Markdown
Member Author

Great, thank you!

@abeldekat abeldekat deleted the jump_ensure_stop branch March 31, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants