aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2020-04-13 22:49:00 +0200
committerGitHub <noreply@github.com>2020-04-13 22:49:00 +0200
commit93b2cb7a3824f91ee24ddf57406d5682699f684b (patch)
tree4ea7bb4aca7520a26a749b0958046ba52b450d4f /src/nvim/fileio.c
parent13b4a6fd4fa67794e76892cb362121a33a756f58 (diff)
parentcf223e7d78df5e8a63b84d423be55a29eefd8883 (diff)
downloadrneovim-93b2cb7a3824f91ee24ddf57406d5682699f684b.tar.gz
rneovim-93b2cb7a3824f91ee24ddf57406d5682699f684b.tar.bz2
rneovim-93b2cb7a3824f91ee24ddf57406d5682699f684b.zip
Merge pull request #11997 from janlazo/vim-8.1.2389
[RDY]vim-patch:8.1.{1745,2147,2280,2282,},8.2.{41,134,365,366,381,387,389,397,398,406,415,457,464,473,474,507,544,549}
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index e5845e0749..88e9390c65 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -407,11 +407,27 @@ readfile(
if (newfile) {
if (apply_autocmds_exarg(EVENT_BUFREADCMD, NULL, sfname,
- FALSE, curbuf, eap))
- return aborting() ? FAIL : OK;
+ false, curbuf, eap)) {
+ int status = OK;
+
+ if (aborting()) {
+ status = FAIL;
+ }
+
+ // The BufReadCmd code usually uses ":read" to get the text and
+ // perhaps ":file" to change the buffer name. But we should
+ // consider this to work like ":edit", thus reset the
+ // BF_NOTEDITED flag. Then ":write" will work to overwrite the
+ // same file.
+ if (status == OK) {
+ curbuf->b_flags &= ~BF_NOTEDITED;
+ }
+ return status;
+ }
} else if (apply_autocmds_exarg(EVENT_FILEREADCMD, sfname, sfname,
- FALSE, NULL, eap))
+ false, NULL, eap)) {
return aborting() ? FAIL : OK;
+ }
curbuf->b_op_start = pos;
}