summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-31 17:34:48 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-31 17:34:48 +0200
commiteea169983654de8a502c2c6521696a4b504abfa3 (patch)
treef7b3ef67d821c51ca2a6d5d6a1f37f035f82ef25
parentccd6e3471df5250611a78489384a91c65fcc43c4 (diff)
downloadvim-git-eea169983654de8a502c2c6521696a4b504abfa3.tar.gz
patch 8.1.1433: win_execute() may leave popup window focusedv8.1.1433
Problem: Win_execute() may leave popup window focused, eventually leading to a crash. (Bjorn Linse) Solution: When previous window was closed, go to the first window.
-rw-r--r--src/testdir/test_popupwin.vim8
-rw-r--r--src/version.c2
-rw-r--r--src/window.c6
3 files changed, 16 insertions, 0 deletions
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 29d4c1531..d0d27b561 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -105,6 +105,14 @@ func Test_popup_with_syntax_setbufvar()
call delete('XtestPopup')
endfunc
+func Test_win_execute_closing_curwin()
+ split
+ let winid = popup_create('some text', {})
+ call win_execute(winid, winnr() .. "close")
+ call assert_equal(1, winnr())
+ popupclear
+endfunc
+
func Test_popup_with_wrap()
if !CanRunVimInTerminal()
return
diff --git a/src/version.c b/src/version.c
index 6bc3d6426..b3f7ee950 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1433,
+/**/
1432,
/**/
1431,
diff --git a/src/window.c b/src/window.c
index 07c8780df..e73a9f492 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6573,6 +6573,12 @@ restore_win_noblock(
curwin = save_curwin;
curbuf = curwin->w_buffer;
}
+#ifdef FEAT_TEXT_PROP
+ else if (bt_popup(curwin->w_buffer))
+ // original window was closed and now we're in a popup window: Go
+ // to the first valid window.
+ win_goto(firstwin);
+#endif
}
/*