Mercurial > vim
diff src/buffer.c @ 32503:5d07e7e9580f v9.0.1583
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Commit: https://github.com/vim/vim/commit/3a2a60ce4a8e73594bca16814672fcc243d093ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 27 18:02:55 2023 +0100
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
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 #12433)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 May 2023 19:15:04 +0200 |
parents | 2707c75175c6 |
children | 448aef880252 |
line wrap: on
line diff
--- a/src/buffer.c +++ b/src/buffer.c @@ -218,6 +218,10 @@ open_buffer( 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); @@ -298,6 +302,11 @@ open_buffer( retval = read_buffer(TRUE, eap, flags); } + // 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) {