summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorii14 <ii14@users.noreply.github.com>2022-07-26 19:44:56 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-26 19:44:56 +0100
commit1f0dc5e84f5cc530c0fb9d0789e3d42d644429d7 (patch)
tree75f0c41f9aa36e549a2f548f58b9dc6f42f46757
parent15b87b6610bfce0c6296bbbad019c944f88a74ca (diff)
downloadvim-git-9.0.0085.tar.gz
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"v9.0.0085
Problem: ":write" fails after ":file name" and the ":edit". Solution: Reset BF_NOTEDITED when using ":edit". (closes #10790)
-rw-r--r--src/ex_cmds.c5
-rw-r--r--src/testdir/test_excmd.vim16
-rw-r--r--src/version.c2
3 files changed, 23 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 5253863c8..6e5e09fbf 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2973,6 +2973,11 @@ do_ecmd(
// Assume success now
retval = OK;
+ // If the file name was changed, reset the not-edit flag so that ":write"
+ // works.
+ if (!other_file)
+ curbuf->b_flags &= ~BF_NOTEDITED;
+
/*
* Check if we are editing the w_arg_idx file in the argument list.
*/
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim
index f55e6a51c..7b270ff6f 100644
--- a/src/testdir/test_excmd.vim
+++ b/src/testdir/test_excmd.vim
@@ -725,5 +725,21 @@ func Test_using_zero_in_range()
bwipe!
endfunc
+" Test :write after changing name with :file and loading it with :edit
+func Test_write_after_rename()
+ call writefile(['text'], 'Xfile')
+
+ enew
+ file Xfile
+ call assert_fails('write', 'E13: File exists (add ! to override)')
+
+ " works OK after ":edit"
+ edit
+ write
+
+ call delete('Xfile')
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 03b65d247..a0caf3e9c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 85,
+/**/
84,
/**/
83,