Tuesday, August 19, 2014

Re: Peculiar spell-check replacement behavior (bug?)

Tim Chase wrote:

> Playing around with the most recent vimgolf challenge, I was
> surprised by the following. To replicate the issue in a document with
> multiple different misspelled words:
>
> - :set spell
>
>
> - On a misspelled word (in the vimgolf case, this is "Mosst") use
>
> 1z=
>
> to select the first replacement. Good (it now reads "Most")
>
> - use "]s" to jump to the next (different) misspelled word (in the
> vimgolf case, this is "heirarchies")
>
> - use "." to repeat the "1z=" action
>
> Expected behavior: the period repeat executes the "z=" action using
> the previous count (1) to choose the first replacement for the word
> under the cursor (in this case, it should be "hierarchies")
>
> Current (well, 7.3.547 on Debian Stable) behavior: the period repeat
> replaces the word under the cursor with the replacement used in the
> previous "1z=" (in this case, it changed "heirarchies" to "Most")
>
> More peculiarly, if you use "2." to choose the 2nd replacement
> choice, it swallowed the space after "heirarchies" but still replaced
> it with "Most", and "3." swallowed the trailing space AND the
> following word.
>
> I found it surprising, but am not sure whether this is a bug (and if
> so, to what degree) or just a mismatch between my expectations and
> reality (tweaking documentation on "." to clarify what qualifies as a
> "simple change" might help clear up my misunderstanding).
>
> Thoughts from others here?

It's documented:

When a word was replaced the redo command "." will
repeat the word replacement. This works like "ciw",
the good word and <Esc>. This does NOT work for Thai
and other languages without spaces between words.

It's one of those choices where there are always some users who expect
it to work otherwise. Anyway, you can easily map "1z=" to some key,
while making a map that repeats replacing with the same word is much
harder.

--
Bumper sticker: Honk if you love peace and quiet.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: