]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4814: possible to leave a popup window with win_gotoid() v8.2.4814
authorLemonBoy <thatlemon@gmail.com>
Sat, 23 Apr 2022 13:07:56 +0000 (14:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 23 Apr 2022 13:07:56 +0000 (14:07 +0100)
Problem:    Possible to leave a popup window with win_gotoid().
Solution:   Give an error when trying to leave a popup window with
            win_gotoid(). (closes #10253)

src/evalwindow.c
src/testdir/test_terminal3.vim
src/version.c

index 43a6d63ef6c981fa80ddc5e128127dd4a43fe200..fd62579cd1e1fc5ee64f014c8467d99094c0c132 100644 (file)
@@ -816,6 +816,13 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv)
        emsg(_(e_invalid_in_cmdline_window));
        return;
     }
+#endif
+#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
+    if (popup_is_popup(curwin) && curbuf->b_term != NULL)
+    {
+       emsg(_(e_not_allowed_for_terminal_in_popup_window));
+       return;
+    }
 #endif
     FOR_ALL_TAB_WINDOWS(tp, wp)
        if (wp->w_id == id)
index 9b5a02f5276e94feaa3ffa6b62b037282870d12d..b798e9a0b9620c19037911a232c69aeff164698d 100644 (file)
@@ -528,6 +528,18 @@ func Test_double_popup_terminal()
   exe buf2 .. 'bwipe!'
 endfunc
 
+func Test_escape_popup_terminal()
+  set hidden
+
+  " Cannot escape a terminal popup window using win_gotoid
+  let prev_win = win_getid()
+  eval term_start('sh', #{hidden: 1, term_finish: 'close'})->popup_create({})
+  call assert_fails("call win_gotoid(" .. prev_win .. ")", 'E863:')
+
+  call popup_clear(1)
+  set hidden&
+endfunc
+
 func Test_issue_5607()
   let wincount = winnr('$')
   exe 'terminal' &shell &shellcmdflag 'exit'
index 7530c1b54bf97139ce7ba61a7e3099a3fdc8ed88..c1096e2f58d7b6a5794d4854478ca31038e5680b 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4814,
 /**/
     4813,
 /**/