Mercurial > vim
changeset 7181:ce8b286e89ef v7.4.901
commit https://github.com/vim/vim/commit/e7d1376b636e6c758196c3542bd2c1053f9edb75
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Oct 30 14:23:33 2015 +0100
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 30 Oct 2015 14:30:04 +0100 |
parents | 6ada823a8ee5 |
children | c6a1a1ea7c19 |
files | src/popupmnu.c src/version.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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. */