Skip to content

Commit d3f78dc

Browse files
committed
patch 8.0.0364: ]s does not move cursor with two spell errors in one line
Problem: ]s does not move cursor with two spell errors in one line. (Manuel Ortega) Solution: Don't stop search immediately when wrapped, search the line first. (Ken Takata) Add a test.
1 parent 3834e3d commit d3f78dc

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,6 +2193,7 @@ test_arglist \
21932193
test_smartindent \
21942194
test_sort \
21952195
test_source_utf8 \
2196+
test_spell \
21962197
test_startup \
21972198
test_startup_utf8 \
21982199
test_stat \

src/spell.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,14 +1734,14 @@ spell_move_to(
17341734
if (curline)
17351735
break; /* only check cursor line */
17361736

1737+
/* If we are back at the starting line and searched it again there
1738+
* is no match, give up. */
1739+
if (lnum == wp->w_cursor.lnum && wrapped)
1740+
break;
1741+
17371742
/* Advance to next line. */
17381743
if (dir == BACKWARD)
17391744
{
1740-
/* If we are back at the starting line and searched it again there
1741-
* is no match, give up. */
1742-
if (lnum == wp->w_cursor.lnum && wrapped)
1743-
break;
1744-
17451745
if (lnum > 1)
17461746
--lnum;
17471747
else if (!p_ws)
@@ -1775,7 +1775,7 @@ spell_move_to(
17751775

17761776
/* If we are back at the starting line and there is no match then
17771777
* give up. */
1778-
if (lnum == wp->w_cursor.lnum && (!found_one || wrapped))
1778+
if (lnum == wp->w_cursor.lnum && !found_one)
17791779
break;
17801780

17811781
/* Skip the characters at the start of the next line that were

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ NEW_TESTS = test_arglist.res \
192192
test_search.res \
193193
test_signs.res \
194194
test_smartindent.res \
195+
test_spell.res \
195196
test_startup.res \
196197
test_startup_utf8.res \
197198
test_stat.res \

src/testdir/test_spell.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
" Test spell checking
2+
" TODO: move test58 tests here
3+
4+
if !has('spell')
5+
finish
6+
endif
7+
8+
func Test_wrap_search()
9+
new
10+
call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End'])
11+
set spell wrapscan
12+
normal ]s
13+
call assert_equal('plong', expand('<cword>'))
14+
normal ]s
15+
call assert_equal('zpelling', expand('<cword>'))
16+
normal ]s
17+
call assert_equal('plong', expand('<cword>'))
18+
bwipe!
19+
set nospell
20+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
364,
767769
/**/
768770
363,
769771
/**/

0 commit comments

Comments
 (0)