mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:8.0.0364 (#7837)
vim-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.
d3f78dc9eb
* disable spell test for now
This commit is contained in:

committed by
Justin M. Keyes

parent
911b1e49ab
commit
9ddeb6e187
@@ -1484,21 +1484,23 @@ spell_move_to (
|
||||
return found_len;
|
||||
}
|
||||
|
||||
if (curline)
|
||||
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)
|
||||
if (lnum > 1) {
|
||||
lnum--;
|
||||
} else if (!p_ws) {
|
||||
break; // at first line and 'nowrapscan'
|
||||
else {
|
||||
} else {
|
||||
// Wrap around to the end of the buffer. May search the
|
||||
// starting line again and accept the last match.
|
||||
lnum = wp->w_buffer->b_ml.ml_line_count;
|
||||
@@ -1523,8 +1525,9 @@ 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
|
||||
// included in a match crossing line boundaries.
|
||||
|
@@ -81,6 +81,7 @@ NEW_TESTS ?= \
|
||||
test_search.res \
|
||||
test_signs.res \
|
||||
test_smartindent.res \
|
||||
test_spell.res \
|
||||
test_stat.res \
|
||||
test_startup.res \
|
||||
test_startup_utf8.res \
|
||||
|
20
src/nvim/testdir/test_spell.vim
Normal file
20
src/nvim/testdir/test_spell.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
" Test spell checking
|
||||
" TODO: move test58 tests here
|
||||
|
||||
if v:true
|
||||
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
|
Reference in New Issue
Block a user