From 85f342a110358358608c05aa1c5c6b433d0cea9a Mon Sep 17 00:00:00 2001 From: Pavel Platto Date: Tue, 20 Jan 2015 20:03:39 +0200 Subject: vim-patch:7.4.446 Problem: In some situations, when setting up an environment to trigger an autocommand, the environment is not properly restored. Solution: Check the return value of switch_win() and call restore_win() always. (Daniel Hahler) https://code.google.com/p/vim/source/detail?r=v7-4-446 --- src/nvim/window.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/nvim/window.c') diff --git a/src/nvim/window.c b/src/nvim/window.c index cf0977e280..52a1853f4b 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1024,7 +1024,7 @@ static void win_init(win_T *newp, win_T *oldp, int flags) } /* - * Initialize window "newp" from window"old". + * Initialize window "newp" from window "old". * Only the essential things are copied. */ static void win_init_some(win_T *newp, win_T *oldp) @@ -5190,8 +5190,8 @@ static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr) /* * Set "win" to be the curwin and "tp" to be the current tab page. - * restore_win() MUST be called to undo. - * No autocommands will be executed. + * restore_win() MUST be called to undo, also when FAIL is returned. + * No autocommands will be executed until restore_win() is called. * When "no_display" is TRUE the display won't be affected, no redraw is * triggered, another tabpage access is limited. * Returns FAIL if switching to "win" failed. @@ -5212,7 +5212,6 @@ int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage goto_tabpage_tp(tp, FALSE, FALSE); } if (!win_valid(win)) { - unblock_autocmds(); return FAIL; } curwin = win; -- cgit