Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.901
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.4.901
Problem:    When a BufLeave autocommand changes folding in a way it syncs
            undo, undo can be corrupted.
Solution:   Prevent undo sync. (Jacob Niehus)
Files:      src/popupmnu.c


*** ../vim-7.4.900/src/popupmnu.c	2014-07-23 21:10:39.867766788 +0200
--- src/popupmnu.c	2015-10-30 14:19:21.681104047 +0100
***************
*** 568,574 ****
--- 568,578 ----
  	    if (p_pvh > 0 && p_pvh < g_do_tagpreview)
  		g_do_tagpreview = p_pvh;
  	    ++RedrawingDisabled;
+ 	    /* Prevent undo sync here, if an autocommand syncs undo weird
+ 	     * things can happen to the undo tree. */
+ 	    ++no_u_sync;
  	    resized = prepare_tagpreview(FALSE);
+ 	    --no_u_sync;
  	    --RedrawingDisabled;
  	    g_do_tagpreview = 0;
  
***************
*** 659,665 ****
--- 663,671 ----
  			 * redraw. */
  			if (resized)
  			{
+ 			    ++no_u_sync;
  			    win_enter(curwin_save, TRUE);
+ 			    --no_u_sync;
  			    update_topline();
  			}
  
***************
*** 670,676 ****
--- 676,686 ----
  			pum_do_redraw = FALSE;
  
  			if (!resized && win_valid(curwin_save))
+ 			{
+ 			    ++no_u_sync;
  			    win_enter(curwin_save, TRUE);
+ 			    --no_u_sync;
+ 			}
  
  			/* May need to update the screen again when there are
  			 * autocommands involved. */
*** ../vim-7.4.900/src/version.c	2015-10-25 22:41:56.703017233 +0100
--- src/version.c	2015-10-30 14:16:43.274962288 +0100
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     901,
  /**/


-- 
Creating the world with Emacs:   M-x let-there-be-light
Creating the world with Vim:     :make world

 /// 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    ///