comparison src/fileio.c @ 19836:c32b295af9c5 v8.2.0474

patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd Commit: https://github.com/vim/vim/commit/0fff44152d06e6b662ad4bef172af07a041d2f3f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 29 16:06:29 2020 +0200 patch 8.2.0474: cannot use :write when using a plugin with BufWriteCmd Problem: Cannot use :write when using a plugin with BufWriteCmd. Solution: Reset BF_NOTEDITED after BufWriteCmd. (closes https://github.com/vim/vim/issues/5807)
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 Mar 2020 16:15:03 +0200
parents 22f0dda71638
children 05b4efb062a7
comparison
equal deleted inserted replaced
19835:b56266f40a71 19836:c32b295af9c5
259 259
260 if (newfile) 260 if (newfile)
261 { 261 {
262 if (apply_autocmds_exarg(EVENT_BUFREADCMD, NULL, sfname, 262 if (apply_autocmds_exarg(EVENT_BUFREADCMD, NULL, sfname,
263 FALSE, curbuf, eap)) 263 FALSE, curbuf, eap))
264 {
265 int status = OK;
264 #ifdef FEAT_EVAL 266 #ifdef FEAT_EVAL
265 return aborting() ? FAIL : OK; 267 if (aborting())
266 #else 268 status = FAIL;
267 return OK; 269 #endif
268 #endif 270 // The BufReadCmd code usually uses ":read" to get the text and
271 // perhaps ":file" to change the buffer name. But we should
272 // consider this to work like ":edit", thus reset the
273 // BF_NOTEDITED flag. Then ":write" will work to overwrite the
274 // same file.
275 if (status == OK)
276 curbuf->b_flags &= ~BF_NOTEDITED;
277 return status;
278 }
269 } 279 }
270 else if (apply_autocmds_exarg(EVENT_FILEREADCMD, sfname, sfname, 280 else if (apply_autocmds_exarg(EVENT_FILEREADCMD, sfname, sfname,
271 FALSE, NULL, eap)) 281 FALSE, NULL, eap))
272 #ifdef FEAT_EVAL 282 #ifdef FEAT_EVAL
273 return aborting() ? FAIL : OK; 283 return aborting() ? FAIL : OK;