comparison src/ex_cmds.c @ 29988:b2140f61826c v9.0.0332

patch 9.0.0332: overwrite check may block BufWriteCmd Commit: https://github.com/vim/vim/commit/9c8f94636b3610b898ffbbd07f6b75866d16cbca Author: zeertzjq <zeertzjq@outlook.com> Date: Tue Aug 30 18:17:15 2022 +0100 patch 9.0.0332: overwrite check may block BufWriteCmd Problem: Overwrite check may block BufWriteCmd. Solution: Do not use overwrite check when 'buftype' is "acwrite". (closes #11011)
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Aug 2022 19:30:03 +0200
parents 4fcf816aa806
children bb0e525e1393
comparison
equal deleted inserted replaced
29987:72c94ab54038 29988:b2140f61826c
2092 int other) // writing under other name 2092 int other) // writing under other name
2093 { 2093 {
2094 /* 2094 /*
2095 * Write to another file or b_flags set or not writing the whole file: 2095 * Write to another file or b_flags set or not writing the whole file:
2096 * overwriting only allowed with '!'. 2096 * overwriting only allowed with '!'.
2097 * If "other" is FALSE and bt_nofilename(buf) is TRUE, this must be
2098 * writing an "acwrite" buffer to the same file as its b_ffname, and
2099 * buf_write() will only allow writing with BufWriteCmd autocommands,
2100 * so there is no need for an overwrite check.
2097 */ 2101 */
2098 if ( (other 2102 if ( (other
2099 || (buf->b_flags & BF_NOTEDITED) 2103 || (!bt_nofilename(buf)
2100 || ((buf->b_flags & BF_NEW) 2104 && ((buf->b_flags & BF_NOTEDITED)
2101 && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) 2105 || ((buf->b_flags & BF_NEW)
2102 || (buf->b_flags & BF_READERR)) 2106 && vim_strchr(p_cpo, CPO_OVERNEW) == NULL)
2107 || (buf->b_flags & BF_READERR))))
2103 && !p_wa 2108 && !p_wa
2104 && vim_fexists(ffname)) 2109 && vim_fexists(ffname))
2105 { 2110 {
2106 if (!eap->forceit && !eap->append) 2111 if (!eap->forceit && !eap->append)
2107 { 2112 {