mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Problem: Reading past end of line with "gf" in Visual block mode. Solution: Do not include the NUL in the length.
This commit is contained in:
13
src/normal.c
13
src/normal.c
@@ -3671,9 +3671,16 @@ get_visual_text(
|
||||
}
|
||||
if (**pp == NUL)
|
||||
*lenp = 0;
|
||||
if (has_mbyte && *lenp > 0)
|
||||
// Correct the length to include all bytes of the last character.
|
||||
*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;
|
||||
if (*lenp > 0)
|
||||
{
|
||||
if (has_mbyte)
|
||||
// Correct the length to include all bytes of the last
|
||||
// character.
|
||||
*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;
|
||||
else if ((*pp)[*lenp - 1] == NUL)
|
||||
// Do not include a trailing NUL.
|
||||
*lenp -= 1;
|
||||
}
|
||||
}
|
||||
reset_VIsual_and_resel();
|
||||
return OK;
|
||||
|
Reference in New Issue
Block a user