diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-25 14:21:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-25 14:21:10 +0100 |
commit | d3f78dc9ebd729475a7f24a50a91112e300d5ac9 (patch) | |
tree | 00afd985ba5dd028f17ce94bd402e43070f6e5c0 /src | |
parent | 3834e3d039777e0144914a86289870bee147c0a2 (diff) | |
download | vim-git-d3f78dc9ebd729475a7f24a50a91112e300d5ac9.tar.gz |
patch 8.0.0364: ]s does not move cursor with two spell errors in one linev8.0.0364
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/spell.c | 12 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 1 | ||||
-rw-r--r-- | src/testdir/test_spell.vim | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 30 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile index 227e1df4e..5ed83628b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2193,6 +2193,7 @@ test_arglist \ test_smartindent \ test_sort \ test_source_utf8 \ + test_spell \ test_startup \ test_startup_utf8 \ test_stat \ diff --git a/src/spell.c b/src/spell.c index 91a48fa77..f124ef21d 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1734,14 +1734,14 @@ spell_move_to( if (curline) break; /* only check cursor line */ + /* If we are back at the starting line and searched it again there + * is no match, give up. */ + if (lnum == wp->w_cursor.lnum && wrapped) + break; + /* Advance to next line. */ if (dir == BACKWARD) { - /* If we are back at the starting line and searched it again there - * is no match, give up. */ - if (lnum == wp->w_cursor.lnum && wrapped) - break; - if (lnum > 1) --lnum; else if (!p_ws) @@ -1775,7 +1775,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 diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 057e8b13a..18dfdc8e7 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -192,6 +192,7 @@ NEW_TESTS = test_arglist.res \ test_search.res \ test_signs.res \ test_smartindent.res \ + test_spell.res \ test_startup.res \ test_startup_utf8.res \ test_stat.res \ diff --git a/src/testdir/test_spell.vim b/src/testdir/test_spell.vim new file mode 100644 index 000000000..e6c3729b1 --- /dev/null +++ b/src/testdir/test_spell.vim @@ -0,0 +1,20 @@ +" Test spell checking +" TODO: move test58 tests here + +if !has('spell') + finish +endif + +func Test_wrap_search() + new + call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End']) + set spell wrapscan + normal ]s + call assert_equal('plong', expand('<cword>')) + normal ]s + call assert_equal('zpelling', expand('<cword>')) + normal ]s + call assert_equal('plong', expand('<cword>')) + bwipe! + set nospell +endfunc diff --git a/src/version.c b/src/version.c index 6b2a9f17c..ffacb9ae8 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 364, +/**/ 363, /**/ 362, |