aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-15 19:26:32 +0800
committerGitHub <noreply@github.com>2022-07-15 19:26:32 +0800
commitb9f15caf5ca879841afe582f68838af208b86142 (patch)
tree783afc0e6f1cc54610b20fe27aeb26625158b5af /src/nvim/fileio.c
parent564d99c89a3d9a236df758d320cc38abc50215ec (diff)
parent0cf5cd1ac9c8ec31c1d2f1b1a6585153a45fc4e9 (diff)
downloadrneovim-b9f15caf5ca879841afe582f68838af208b86142.tar.gz
rneovim-b9f15caf5ca879841afe582f68838af208b86142.tar.bz2
rneovim-b9f15caf5ca879841afe582f68838af208b86142.zip
Merge pull request #19375 from zeertzjq/vim-8.2.0403
vim-patch:8.1.1547,8.2.0403: when 'buftype' is "nofile" there is no overwrite check
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index febde53ce2..6782465ef1 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -2286,7 +2286,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
&& reset_changed
&& whole
&& buf == curbuf
- && !bt_nofile(buf)
+ && !bt_nofilename(buf)
&& !filtering
&& (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL)
&& vim_strchr(p_cpo, CPO_FNAMEW) != NULL) {
@@ -2360,22 +2360,22 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
if (append) {
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD,
- sfname, sfname, FALSE, curbuf, eap))) {
- if (overwriting && bt_nofile(curbuf)) {
- nofile_err = TRUE;
+ sfname, sfname, false, curbuf, eap))) {
+ if (overwriting && bt_nofilename(curbuf)) {
+ nofile_err = true;
} else {
apply_autocmds_exarg(EVENT_FILEAPPENDPRE,
- sfname, sfname, FALSE, curbuf, eap);
+ sfname, sfname, false, curbuf, eap);
}
}
} else if (filtering) {
apply_autocmds_exarg(EVENT_FILTERWRITEPRE,
- NULL, sfname, FALSE, curbuf, eap);
+ NULL, sfname, false, curbuf, eap);
} else if (reset_changed && whole) {
int was_changed = curbufIsChanged();
did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD,
- sfname, sfname, FALSE, curbuf, eap);
+ sfname, sfname, false, curbuf, eap);
if (did_cmd) {
if (was_changed && !curbufIsChanged()) {
/* Written everything correctly and BufWriteCmd has reset
@@ -2385,21 +2385,21 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
u_update_save_nr(curbuf);
}
} else {
- if (overwriting && bt_nofile(curbuf)) {
- nofile_err = TRUE;
+ if (overwriting && bt_nofilename(curbuf)) {
+ nofile_err = true;
} else {
apply_autocmds_exarg(EVENT_BUFWRITEPRE,
- sfname, sfname, FALSE, curbuf, eap);
+ sfname, sfname, false, curbuf, eap);
}
}
} else {
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD,
- sfname, sfname, FALSE, curbuf, eap))) {
- if (overwriting && bt_nofile(curbuf)) {
- nofile_err = TRUE;
+ sfname, sfname, false, curbuf, eap))) {
+ if (overwriting && bt_nofilename(curbuf)) {
+ nofile_err = true;
} else {
apply_autocmds_exarg(EVENT_FILEWRITEPRE,
- sfname, sfname, FALSE, curbuf, eap);
+ sfname, sfname, false, curbuf, eap);
}
}
}
@@ -4306,7 +4306,7 @@ void shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
char *p;
if (buf->b_fname != NULL
- && !bt_nofile(buf)
+ && !bt_nofilename(buf)
&& !path_with_url(buf->b_fname)
&& (force
|| buf->b_sfname == NULL