mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.4151: reading beyond the end of a line
Problem: Reading beyond the end of a line. Solution: For block insert only use the offset for correcting the length.
This commit is contained in:
19
src/ops.c
19
src/ops.c
@@ -529,24 +529,9 @@ block_insert(
|
||||
}
|
||||
|
||||
if (has_mbyte && spaces > 0)
|
||||
{
|
||||
int off;
|
||||
// avoid copying part of a multi-byte character
|
||||
offset -= (*mb_head_off)(oldp, oldp + offset);
|
||||
|
||||
// Avoid starting halfway a multi-byte character.
|
||||
if (b_insert)
|
||||
{
|
||||
off = (*mb_head_off)(oldp, oldp + offset + spaces);
|
||||
spaces -= off;
|
||||
count -= off;
|
||||
}
|
||||
else
|
||||
{
|
||||
// spaces fill the gap, the character that's at the edge moves
|
||||
// right
|
||||
off = (*mb_head_off)(oldp, oldp + offset);
|
||||
offset -= off;
|
||||
}
|
||||
}
|
||||
if (spaces < 0) // can happen when the cursor was moved
|
||||
spaces = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user