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)

3a2a60ce4a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-05-28 08:06:30 +08:00
committed by GitHub
parent b46f61ac05
commit 7a8402ac31
5 changed files with 100 additions and 65 deletions

View File

@@ -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);