mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
vim-patch:9.0.0332: overwrite check may block BufWriteCmd (#20014)
Problem: Overwrite check may block BufWriteCmd.
Solution: Do not use overwrite check when 'buftype' is "acwrite".
(closes vim/vim#11011)
9c8f94636b
This commit is contained in:
@@ -1996,11 +1996,16 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char *fname, char *ffname, int oth
|
||||
{
|
||||
// Write to another file or b_flags set or not writing the whole file:
|
||||
// overwriting only allowed with '!'
|
||||
// If "other" is false and bt_nofilename(buf) is true, this must be
|
||||
// writing an "acwrite" buffer to the same file as its b_ffname, and
|
||||
// buf_write() will only allow writing with BufWriteCmd autocommands,
|
||||
// so there is no need for an overwrite check.
|
||||
if ((other
|
||||
|| (buf->b_flags & BF_NOTEDITED)
|
||||
|| ((buf->b_flags & BF_NEW)
|
||||
&& vim_strchr(p_cpo, CPO_OVERNEW) == NULL)
|
||||
|| (buf->b_flags & BF_READERR))
|
||||
|| (!bt_nofilename(buf)
|
||||
&& ((buf->b_flags & BF_NOTEDITED)
|
||||
|| ((buf->b_flags & BF_NEW)
|
||||
&& vim_strchr(p_cpo, CPO_OVERNEW) == NULL)
|
||||
|| (buf->b_flags & BF_READERR))))
|
||||
&& !p_wa
|
||||
&& os_path_exists((char_u *)ffname)) {
|
||||
if (!eap->forceit && !eap->append) {
|
||||
|
Reference in New Issue
Block a user