1
0
forked from aniani/vim

patch 8.2.0109: corrupted text properties when expanding spaces

Problem:    Corrupted text properties when expanding spaces.
Solution:   Reallocate the line. (Nobuhiro Takasaki, closes #5457)
This commit is contained in:
Bram Moolenaar
2020-01-09 21:35:48 +01:00
parent bf0acff012
commit ac15fd8c67
3 changed files with 86 additions and 13 deletions

View File

@@ -5604,9 +5604,25 @@ ins_tab(void)
#ifdef FEAT_PROP_POPUP
if (!(State & VREPLACE_FLAG))
{
mch_memmove(ptr, ptr + i, curbuf->b_ml.ml_line_len - i
- (ptr - curbuf->b_ml.ml_line_ptr));
char_u *newp;
int col;
newp = alloc(curbuf->b_ml.ml_line_len - i);
if (newp == NULL)
return FALSE;
col = ptr - curbuf->b_ml.ml_line_ptr;
if (col > 0)
mch_memmove(newp, ptr - col, col);
mch_memmove(newp + col, ptr + i,
curbuf->b_ml.ml_line_len - col - i);
if (curbuf->b_ml.ml_flags & ML_LINE_DIRTY)
vim_free(curbuf->b_ml.ml_line_ptr);
curbuf->b_ml.ml_line_ptr = newp;
curbuf->b_ml.ml_line_len -= i;
curbuf->b_ml.ml_flags =
(curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
}
else
#endif