Hi,
2017/2/24 Fri 8:42:16 UTC+9 Manuel Ortega wrote:
> The ]s command for moving to the next spelling error has become broken
> recently. Sometime within the last three weeks I would guess.
>
>
> Create a text file called "foo" containing the following text (one line):
>
>
> This was a tricky problem. We're given a sheep, and a shoezp where A is the
> incumbent senator and the dzenj said hello.
>
>
> Now from the terminal do `vim -u NONE -i NONE -N --noplugin foo`.
>
>
> Then do ":set spell". The two error words are then highlighted. Hit ]s
> twice to put the cursor on the word "dzenj". Now hit ]s again.
>
>
> Expected behavior: the cursor cycles around and lands on the world "shoezp".
>
>
> Actual behavior: Despite seeing a "search hit BOTTOM, continuing at TOP"
> message (as I should), the cursor stays stuck on the last error word "dzjenj"
> and won't cycle around.
>
>
> I note that the [s command cycles between the two erros as expected. Only ]s
> is broken.
>
>
> This is not an artifact of the test file containing only one line, because if
> I add other lines to "foo" that contain no spelling errors, I see the same
> behavior.
>
>
> This is macOS 10.12.3, vim 8.0.363.
It seems that this occurs when the cursor is in the first line and there are
no wrong words after the second line. Maybe, this was so for a long time,
not broken recently.
I think attached patch fixes the problem. Not tested well, though.
Maybe, comments should be properly updated.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent d833b4e08bed520ee810f11d8147a77bd7f53d6e
diff --git a/src/spell.c b/src/spell.c
--- a/src/spell.c
+++ b/src/spell.c
@@ -1759,6 +1759,11 @@ spell_move_to(
}
else
{
+ /* If we are back at the starting line and there is no match then
+ * give up. */
+ if (lnum == wp->w_cursor.lnum && wrapped)
+ break;
+
if (lnum < wp->w_buffer->b_ml.ml_line_count)
++lnum;
else if (!p_ws)
@@ -1775,7 +1780,7 @@ spell_move_to(
/* If we are back at the starting line and there is no match then
* give up. */
- if (lnum == wp->w_cursor.lnum && (!found_one || wrapped))
+ if (lnum == wp->w_cursor.lnum && !found_one)
break;
/* Skip the characters at the start of the next line that were