diff options
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index dab07487cd..bc52ab0771 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -248,6 +248,11 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg) return FAIL; } + // Do not sync this buffer yet, may first want to read the file. + if (curbuf->b_ml.ml_mfp != NULL) { + curbuf->b_ml.ml_mfp->mf_dirty = MF_DIRTY_YES_NOSYNC; + } + // The autocommands in readfile() may change the buffer, but only AFTER // reading the file. set_bufref(&old_curbuf, curbuf); @@ -316,6 +321,12 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg) } } + // Can now sync this buffer in ml_sync_all(). + if (curbuf->b_ml.ml_mfp != NULL + && curbuf->b_ml.ml_mfp->mf_dirty == MF_DIRTY_YES_NOSYNC) { + curbuf->b_ml.ml_mfp->mf_dirty = MF_DIRTY_YES; + } + // if first time loading this buffer, init b_chartab[] if (curbuf->b_flags & BF_NEVERLOADED) { (void)buf_init_chartab(curbuf, false); |