vim-patch:9.1.1758: Diff mode crashes when adding text property in autocommand (#35760)

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: vim/vim#18288
closes: vim/vim#18291

46e22fd2f7
This commit is contained in:
zeertzjq
2025-09-15 07:17:37 +08:00
committed by GitHub
parent fbb1caf5f8
commit 7b8b9d270f
2 changed files with 26 additions and 1 deletions

View File

@@ -874,7 +874,7 @@ static int 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;
}