Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.646
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.646
Problem:    When reloading a buffer the undo file becomes unusable unless ":w"
	    is executed. (Dmitri Frank)
Solution:   After reloading the buffer write the undo file. (Christian
	    Brabandt)
Files:	    src/fileio.c


*** ../vim-7.3.645/src/fileio.c	2012-07-10 17:14:50.000000000 +0200
--- src/fileio.c	2012-08-29 18:19:44.000000000 +0200
***************
*** 7060,7067 ****
--- 7060,7082 ----
      }
  
      if (reload)
+     {
  	/* Reload the buffer. */
  	buf_reload(buf, orig_mode);
+ #ifdef FEAT_PERSISTENT_UNDO
+ 	if (buf->b_p_udf && buf->b_ffname != NULL)
+ 	{
+ 	    char_u	    hash[UNDO_HASH_SIZE];
+ 	    buf_T	    *save_curbuf = curbuf;
+ 
+ 	    /* Any existing undo file is unusable, write it now. */
+ 	    curbuf = buf;
+ 	    u_compute_hash(hash);
+ 	    u_write_undo(NULL, FALSE, buf, hash);
+ 	    curbuf = save_curbuf;
+ 	}
+ #endif
+     }
  
  #ifdef FEAT_AUTOCMD
      /* Trigger FileChangedShell when the file was changed in any way. */
*** ../vim-7.3.645/src/version.c	2012-08-29 16:55:09.000000000 +0200
--- src/version.c	2012-08-29 18:21:07.000000000 +0200
***************
*** 721,722 ****
--- 721,724 ----
  {   /* Add new patch number below this line */
+ /**/
+     646,
  /**/

-- 
   An extraordinary TALL KNIGHT in all black (possibly John with Mike on his
   shoulders) walks out from the dark trees.  He is extremely fierce and
   gruesome countenance.  He walks towards KING ARTHUR and PATSY, who are
   wazzing like mad.  (Salopian slang, meaning very scared.  almost to the
   point of wetting oneself, e.g. before an important football match or
   prior to a postering.  Salopian slang meaning a beating by the school
   praeposters.  Sorry about the Salopian slant to this stage direction - Ed.)
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///