mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch:8.2.4563: "z=" in Visual mode may go beyond the end of the line
Problem: "z=" in Visual mode may go beyond the end of the line.
Solution: Adjust "badlen".
5c68617d39
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -483,6 +483,11 @@ void spell_suggest(int count)
|
|||||||
}
|
}
|
||||||
badlen++;
|
badlen++;
|
||||||
end_visual_mode();
|
end_visual_mode();
|
||||||
|
// make sure we don't include the NUL at the end of the line
|
||||||
|
line = get_cursor_line_ptr();
|
||||||
|
if (badlen > (int)strlen(line) - (int)curwin->w_cursor.col) {
|
||||||
|
badlen = (int)strlen(line) - (int)curwin->w_cursor.col;
|
||||||
|
}
|
||||||
// Find the start of the badly spelled word.
|
// Find the start of the badly spelled word.
|
||||||
} else if (spell_move_to(curwin, FORWARD, true, true, NULL) == 0
|
} else if (spell_move_to(curwin, FORWARD, true, true, NULL) == 0
|
||||||
|| curwin->w_cursor.col > prev_cursor.col) {
|
|| curwin->w_cursor.col > prev_cursor.col) {
|
||||||
|
@@ -531,8 +531,23 @@ func Test_spellsuggest_timeout()
|
|||||||
call assert_fails('set spellsuggest=timeout:--9', 'E474:')
|
call assert_fails('set spellsuggest=timeout:--9', 'E474:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_spellsuggest_visual_end_of_line()
|
||||||
|
let enc_save = &encoding
|
||||||
|
" set encoding=iso8859
|
||||||
|
|
||||||
|
" This was reading beyond the end of the line.
|
||||||
|
norm R00000000000
|
||||||
|
sil norm 0
|
||||||
|
sil! norm i00000)
|
||||||
|
sil! norm i00000)
|
||||||
|
call feedkeys("\<CR>")
|
||||||
|
norm z=
|
||||||
|
|
||||||
|
let &encoding = enc_save
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_spellinfo()
|
func Test_spellinfo()
|
||||||
throw 'skipped: Nvim does not support enc=latin1'
|
throw 'Skipped: Nvim does not support enc=latin1'
|
||||||
new
|
new
|
||||||
let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
|
let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user