patch 9.1.1758: Diff mode crashes when adding text property in autocommand

Problem:  Diff mode crashes when adding text property in autocommand
          (after 9.1.1557).
Solution: Only restore ML_EMPTY memline flag, ignore the others
          (zeertzjq).

fixes: #18288
closes: #18291

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-09-14 11:01:26 -04:00
committed by Christian Brabandt
parent 1e7a288cd3
commit 46e22fd2f7
4 changed files with 49 additions and 1 deletions

View File

@ -917,7 +917,8 @@ diff_write(buf_T *buf, diffin_T *din, linenr_T start, linenr_T end)
cmdmod.cmod_flags = save_cmod_flags;
free_string_option(buf->b_p_ff);
buf->b_p_ff = save_ff;
buf->b_ml.ml_flags = save_ml_flags;
buf->b_ml.ml_flags =
(buf->b_ml.ml_flags & ~ML_EMPTY) | (save_ml_flags & ML_EMPTY);
return r;
}