mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 07:48:18 +00:00
vim-patch:8.0.1433: illegal memory access after undo
Problem: Illegal memory access after undo. (Dominique Pelle)
Solution: Avoid the column becomes negative. (Christian Brabandt,
closes vim/vim#2533)
95dbcbea6d
This commit is contained in:
@@ -1465,7 +1465,11 @@ void mark_mb_adjustpos(buf_T *buf, pos_T *lp)
|
||||
{
|
||||
if (lp->col > 0 || lp->coladd > 1) {
|
||||
const char_u *const p = ml_get_buf(buf, lp->lnum, false);
|
||||
lp->col -= (*mb_head_off)(p, p + lp->col);
|
||||
if (*p == NUL || (int)STRLEN(p) < lp->col) {
|
||||
lp->col = 0;
|
||||
} else {
|
||||
lp->col -= (*mb_head_off)(p, p + lp->col);
|
||||
}
|
||||
// Reset "coladd" when the cursor would be on the right half of a
|
||||
// double-wide character.
|
||||
if (lp->coladd == 1
|
||||
|
Reference in New Issue
Block a user