mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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".
This commit is contained in:
parent
b29b96806f
commit
5c68617d39
@ -506,6 +506,10 @@ spell_suggest(int count)
|
|||||||
curwin->w_cursor.col = VIsual.col;
|
curwin->w_cursor.col = VIsual.col;
|
||||||
++badlen;
|
++badlen;
|
||||||
end_visual_mode();
|
end_visual_mode();
|
||||||
|
// make sure we don't include the NUL at the end of the line
|
||||||
|
line = ml_get_curline();
|
||||||
|
if (badlen > STRLEN(line) - curwin->w_cursor.col)
|
||||||
|
badlen = STRLEN(line) - 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
|
||||||
|
@ -456,6 +456,21 @@ 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()
|
||||||
new
|
new
|
||||||
let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
|
let runtime = substitute($VIMRUNTIME, '\\', '/', 'g')
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4563,
|
||||||
/**/
|
/**/
|
||||||
4562,
|
4562,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user