a20c56c
To: vim_dev@googlegroups.com
a20c56c
Subject: Patch 7.4.901
a20c56c
Fcc: outbox
a20c56c
From: Bram Moolenaar <Bram@moolenaar.net>
a20c56c
Mime-Version: 1.0
a20c56c
Content-Type: text/plain; charset=UTF-8
a20c56c
Content-Transfer-Encoding: 8bit
a20c56c
------------
a20c56c
a20c56c
Patch 7.4.901
a20c56c
Problem:    When a BufLeave autocommand changes folding in a way it syncs
a20c56c
            undo, undo can be corrupted.
a20c56c
Solution:   Prevent undo sync. (Jacob Niehus)
a20c56c
Files:      src/popupmnu.c
a20c56c
a20c56c
a20c56c
*** ../vim-7.4.900/src/popupmnu.c	2014-07-23 21:10:39.867766788 +0200
a20c56c
--- src/popupmnu.c	2015-10-30 14:19:21.681104047 +0100
a20c56c
***************
a20c56c
*** 568,574 ****
a20c56c
--- 568,578 ----
a20c56c
  	    if (p_pvh > 0 && p_pvh < g_do_tagpreview)
a20c56c
  		g_do_tagpreview = p_pvh;
a20c56c
  	    ++RedrawingDisabled;
a20c56c
+ 	    /* Prevent undo sync here, if an autocommand syncs undo weird
a20c56c
+ 	     * things can happen to the undo tree. */
a20c56c
+ 	    ++no_u_sync;
a20c56c
  	    resized = prepare_tagpreview(FALSE);
a20c56c
+ 	    --no_u_sync;
a20c56c
  	    --RedrawingDisabled;
a20c56c
  	    g_do_tagpreview = 0;
a20c56c
  
a20c56c
***************
a20c56c
*** 659,665 ****
a20c56c
--- 663,671 ----
a20c56c
  			 * redraw. */
a20c56c
  			if (resized)
a20c56c
  			{
a20c56c
+ 			    ++no_u_sync;
a20c56c
  			    win_enter(curwin_save, TRUE);
a20c56c
+ 			    --no_u_sync;
a20c56c
  			    update_topline();
a20c56c
  			}
a20c56c
  
a20c56c
***************
a20c56c
*** 670,676 ****
a20c56c
--- 676,686 ----
a20c56c
  			pum_do_redraw = FALSE;
a20c56c
  
a20c56c
  			if (!resized && win_valid(curwin_save))
a20c56c
+ 			{
a20c56c
+ 			    ++no_u_sync;
a20c56c
  			    win_enter(curwin_save, TRUE);
a20c56c
+ 			    --no_u_sync;
a20c56c
+ 			}
a20c56c
  
a20c56c
  			/* May need to update the screen again when there are
a20c56c
  			 * autocommands involved. */
a20c56c
*** ../vim-7.4.900/src/version.c	2015-10-25 22:41:56.703017233 +0100
a20c56c
--- src/version.c	2015-10-30 14:16:43.274962288 +0100
a20c56c
***************
a20c56c
*** 743,744 ****
a20c56c
--- 743,746 ----
a20c56c
  {   /* Add new patch number below this line */
a20c56c
+ /**/
a20c56c
+     901,
a20c56c
  /**/
a20c56c
a20c56c
a20c56c
-- 
a20c56c
Creating the world with Emacs:   M-x let-there-be-light
a20c56c
Creating the world with Vim:     :make world
a20c56c
a20c56c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
a20c56c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
a20c56c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
a20c56c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///