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)
diff --git a/src/edit.c b/src/edit.c
index d2e45dd..8160fe5 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -5604,9 +5604,25 @@
 #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