Skip to content

Commit e7d1376

Browse files
committed
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)
1 parent f1a4c98 commit e7d1376

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/popupmnu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,11 @@ pum_set_selected(n, repeat)
568568
if (p_pvh > 0 && p_pvh < g_do_tagpreview)
569569
g_do_tagpreview = p_pvh;
570570
++RedrawingDisabled;
571+
/* Prevent undo sync here, if an autocommand syncs undo weird
572+
* things can happen to the undo tree. */
573+
++no_u_sync;
571574
resized = prepare_tagpreview(FALSE);
575+
--no_u_sync;
572576
--RedrawingDisabled;
573577
g_do_tagpreview = 0;
574578

@@ -659,7 +663,9 @@ pum_set_selected(n, repeat)
659663
* redraw. */
660664
if (resized)
661665
{
666+
++no_u_sync;
662667
win_enter(curwin_save, TRUE);
668+
--no_u_sync;
663669
update_topline();
664670
}
665671

@@ -670,7 +676,11 @@ pum_set_selected(n, repeat)
670676
pum_do_redraw = FALSE;
671677

672678
if (!resized && win_valid(curwin_save))
679+
{
680+
++no_u_sync;
673681
win_enter(curwin_save, TRUE);
682+
--no_u_sync;
683+
}
674684

675685
/* May need to update the screen again when there are
676686
* autocommands involved. */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
901,
744746
/**/
745747
900,
746748
/**/

0 commit comments

Comments
 (0)