]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.1433: win_execute() may leave popup window focused v8.1.1433
authorBram Moolenaar <Bram@vim.org>
Fri, 31 May 2019 15:34:48 +0000 (17:34 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 31 May 2019 15:34:48 +0000 (17:34 +0200)
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.

src/testdir/test_popupwin.vim
src/version.c
src/window.c

index 29d4c1531662e8cc86bce6e157d68054a5f1e3f8..d0d27b56181bc7342f172f8a27dcd139c9be52fc 100644 (file)
@@ -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
index 6bc3d6426d2e34b930fadfd1d8b2846d1ecd8e40..b3f7ee95042583275a29aaa840aa809107e24371 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1433,
 /**/
     1432,
 /**/
index 07c8780df20399519032a29eec095c29388c47d7..e73a9f4921bd4cf08a8d3df935f9a6c1f076c77e 100644 (file)
@@ -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
 }
 
 /*