1
0
forked from aniani/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".
This commit is contained in:
Bram Moolenaar
2022-03-13 20:12:25 +00:00
parent b29b96806f
commit 5c68617d39
3 changed files with 21 additions and 0 deletions

View File

@@ -506,6 +506,10 @@ spell_suggest(int count)
curwin->w_cursor.col = VIsual.col;
++badlen;
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.
else if (spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL) == 0