Patch 9.0.0085
Problem:    ":write" fails after ":file name" and then ":edit".
Solution:   Reset BF_NOTEDITED when using ":edit". (closes #10790)
Files:      src/ex_cmds.c, src/testdir/test_excmd.vim


*** ../vim-9.0.0084/src/ex_cmds.c       2022-07-07 22:20:28.445941352 +0100
--- src/ex_cmds.c       2022-07-26 19:41:39.441912587 +0100
***************
*** 2973,2978 ****
--- 2973,2983 ----
      // 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.
       */
*** ../vim-9.0.0084/src/testdir/test_excmd.vim  2022-05-28 14:23:05.000000000 
+0100
--- src/testdir/test_excmd.vim  2022-07-26 19:42:30.781620440 +0100
***************
*** 725,729 ****
--- 725,745 ----
    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
*** ../vim-9.0.0084/src/version.c       2022-07-26 19:18:23.864892621 +0100
--- src/version.c       2022-07-26 19:44:37.796968361 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     85,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
139. You down your lunch in five minutes, at your desk, so you can
     spend the rest of the hour surfing the Net.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220726184651.EE4281C07D4%40moolenaar.net.

Raspunde prin e-mail lui