Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single word correction (Zl) can fail without &wrapscan #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KSR-Yasuda
Copy link

How to repro

Run Zl at the pos below:

CORSS.CORSS
      ^

It happens if

  • &wrapscan is disabled (set nowrapscan)
  • The wrong words appear more than once in the buffer
  • Cursor is on the beginning of the last word

Why this happens

In single word correction in spelunker#words#replace_word(),
it does /SERCHWORD/, N (move to previous word), and change the target word.

With &wrapscan (successful case),
it does /SEARCHWORD/ to move the next word, and comes back to the target word by N.

Without &wrapscan (bad case),
since the target word is the last appearance in the buf,
the /SEARCHWORD/ command fails, and cursor keeps its position.
So, if the cursor is on the beggining of the word,
the following N command jumps to the word before the target unexpectedly.

To fix this instantly, set &wrapscan in the operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant