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:
20
src/edit.c
20
src/edit.c
@@ -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
|
||||
|
Reference in New Issue
Block a user