aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-28 08:06:30 +0800
committerGitHub <noreply@github.com>2023-05-28 08:06:30 +0800
commit7a8402ac31aa2e155baafbc925c48527511c1e92 (patch)
treed69c2541099318c6f6cb3bf3847f158b654b6911 /src/nvim/buffer.c
parentb46f61ac050e6eb530ceb4d4b510b612596427c5 (diff)
downloadrneovim-7a8402ac31aa2e155baafbc925c48527511c1e92.tar.gz
rneovim-7a8402ac31aa2e155baafbc925c48527511c1e92.tar.bz2
rneovim-7a8402ac31aa2e155baafbc925c48527511c1e92.zip
vim-patch:9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2" (#23790)
Problem: Get E304 when using 'cryptmethod' "xchacha20v2". (Steve Mynott) Solution: Add 4th crypt method to block zero ID check. Avoid syncing a swap file before reading the file. (closes vim/vim#12433) https://github.com/vim/vim/commit/3a2a60ce4a8e73594bca16814672fcc243d093ac Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c11
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);