]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.290 v7.3.290
authorBram Moolenaar <Bram@vim.org>
Fri, 2 Sep 2011 09:56:20 +0000 (11:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 2 Sep 2011 09:56:20 +0000 (11:56 +0200)
Problem:    When a BufWriteCmd autocommand resets 'modified' this doesn't
            change older buffer states to be marked as 'modified' like
            ":write" does.  (Yukihiro Nakadaira)
Solution:   When the BufWriteCmd resets 'modified' then adjust the undo
            information like ":write" does.

src/fileio.c
src/version.c

index 4113287870936f20a0f6b9f1f8289d789856147f..b30d31102e35f98bf2e454aa21560c62c579c0ff 100644 (file)
@@ -3342,8 +3342,22 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
        }
        else if (reset_changed && whole)
        {
-           if (!(did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD,
-                                        sfname, sfname, FALSE, curbuf, eap)))
+           int was_changed = curbufIsChanged();
+
+           did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD,
+                                         sfname, sfname, FALSE, curbuf, eap);
+           if (did_cmd)
+           {
+               if (was_changed && !curbufIsChanged())
+               {
+                   /* Written everything correctly and BufWriteCmd has reset
+                    * 'modified': Correct the undo information so that an
+                    * undo now sets 'modified'. */
+                   u_unchanged(curbuf);
+                   u_update_save_nr(curbuf);
+               }
+           }
+           else
            {
 #ifdef FEAT_QUICKFIX
                if (overwriting && bt_nofile(curbuf))
index 925ff2477631381886315c8bc1de08219d5f4eff..7d11c6ffa065e6e9863458e54c9a265c4ca43920 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    290,
 /**/
     289,
 /**/