summaryrefslogtreecommitdiff
path: root/src/popupmnu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-10-30 14:23:33 +0100
committerBram Moolenaar <Bram@vim.org>2015-10-30 14:23:33 +0100
commite7d1376b636e6c758196c3542bd2c1053f9edb75 (patch)
treef78dab087813cc38e259af922f4b501e0b02d028 /src/popupmnu.c
parentf1a4c98ea6fa122ceb24c1ad17e184703cbfd182 (diff)
downloadvim-git-e7d1376b636e6c758196c3542bd2c1053f9edb75.tar.gz
patch 7.4.901v7.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)
Diffstat (limited to 'src/popupmnu.c')
-rw-r--r--src/popupmnu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 68ee2d562..2f5e7dc81 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -568,7 +568,11 @@ pum_set_selected(n, repeat)
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,7 +663,9 @@ pum_set_selected(n, repeat)
* redraw. */
if (resized)
{
+ ++no_u_sync;
win_enter(curwin_save, TRUE);
+ --no_u_sync;
update_topline();
}
@@ -670,7 +676,11 @@ pum_set_selected(n, repeat)
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. */