Karsten Hopp 5b1712
To: vim_dev@googlegroups.com
Karsten Hopp 5b1712
Subject: Patch 7.3.290
Karsten Hopp 5b1712
Fcc: outbox
Karsten Hopp 5b1712
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5b1712
Mime-Version: 1.0
Karsten Hopp 5b1712
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 5b1712
Content-Transfer-Encoding: 8bit
Karsten Hopp 5b1712
------------
Karsten Hopp 5b1712
Karsten Hopp 5b1712
Patch 7.3.290
Karsten Hopp 5b1712
Problem:    When a BufWriteCmd autocommand resets 'modified' this doesn't
Karsten Hopp 5b1712
	    change older buffer states to be marked as 'modified' like
Karsten Hopp 5b1712
	    ":write" does.  (Yukihiro Nakadaira)
Karsten Hopp 5b1712
Solution:   When the BufWriteCmd resets 'modified' then adjust the undo
Karsten Hopp 5b1712
	    information like ":write" does.
Karsten Hopp 5b1712
Files:	    src/fileio.c
Karsten Hopp 5b1712
Karsten Hopp 5b1712
Karsten Hopp 5b1712
*** ../vim-7.3.289/src/fileio.c	2011-07-20 18:29:33.000000000 +0200
Karsten Hopp 5b1712
--- src/fileio.c	2011-08-29 21:49:27.000000000 +0200
Karsten Hopp 5b1712
***************
Karsten Hopp 5b1712
*** 3342,3349 ****
Karsten Hopp 5b1712
  	}
Karsten Hopp 5b1712
  	else if (reset_changed && whole)
Karsten Hopp 5b1712
  	{
Karsten Hopp 5b1712
! 	    if (!(did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD,
Karsten Hopp 5b1712
! 					 sfname, sfname, FALSE, curbuf, eap)))
Karsten Hopp 5b1712
  	    {
Karsten Hopp 5b1712
  #ifdef FEAT_QUICKFIX
Karsten Hopp 5b1712
  		if (overwriting && bt_nofile(curbuf))
Karsten Hopp 5b1712
--- 3342,3363 ----
Karsten Hopp 5b1712
  	}
Karsten Hopp 5b1712
  	else if (reset_changed && whole)
Karsten Hopp 5b1712
  	{
Karsten Hopp 5b1712
! 	    int was_changed = curbufIsChanged();
Karsten Hopp 5b1712
! 
Karsten Hopp 5b1712
! 	    did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD,
Karsten Hopp 5b1712
! 					  sfname, sfname, FALSE, curbuf, eap);
Karsten Hopp 5b1712
! 	    if (did_cmd)
Karsten Hopp 5b1712
! 	    {
Karsten Hopp 5b1712
! 		if (was_changed && !curbufIsChanged())
Karsten Hopp 5b1712
! 		{
Karsten Hopp 5b1712
! 		    /* Written everything correctly and BufWriteCmd has reset
Karsten Hopp 5b1712
! 		     * 'modified': Correct the undo information so that an
Karsten Hopp 5b1712
! 		     * undo now sets 'modified'. */
Karsten Hopp 5b1712
! 		    u_unchanged(curbuf);
Karsten Hopp 5b1712
! 		    u_update_save_nr(curbuf);
Karsten Hopp 5b1712
! 		}
Karsten Hopp 5b1712
! 	    }
Karsten Hopp 5b1712
! 	    else
Karsten Hopp 5b1712
  	    {
Karsten Hopp 5b1712
  #ifdef FEAT_QUICKFIX
Karsten Hopp 5b1712
  		if (overwriting && bt_nofile(curbuf))
Karsten Hopp 5b1712
*** ../vim-7.3.289/src/version.c	2011-08-28 16:02:23.000000000 +0200
Karsten Hopp 5b1712
--- src/version.c	2011-09-02 11:37:25.000000000 +0200
Karsten Hopp 5b1712
***************
Karsten Hopp 5b1712
*** 711,712 ****
Karsten Hopp 5b1712
--- 711,714 ----
Karsten Hopp 5b1712
  {   /* Add new patch number below this line */
Karsten Hopp 5b1712
+ /**/
Karsten Hopp 5b1712
+     290,
Karsten Hopp 5b1712
  /**/
Karsten Hopp 5b1712
Karsten Hopp 5b1712
-- 
Karsten Hopp 5b1712
OLD WOMAN: Well, how did you become king, then?
Karsten Hopp 5b1712
ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite,
Karsten Hopp 5b1712
        held Excalibur aloft from the bosom of the water to signify by Divine
Karsten Hopp 5b1712
        Providence ...  that I, Arthur, was to carry Excalibur ...  That is
Karsten Hopp 5b1712
        why I am your king!
Karsten Hopp 5b1712
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 5b1712
Karsten Hopp 5b1712
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5b1712
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5b1712
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 5b1712
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///