changeset 28580:39df510f97c3 v8.2.4814

patch 8.2.4814: possible to leave a popup window with win_gotoid() Commit: https://github.com/vim/vim/commit/4a392d244018fadda375a490f4f4b921023248b9 Author: LemonBoy <thatlemon@gmail.com> Date: Sat Apr 23 14:07:56 2022 +0100 patch 8.2.4814: possible to leave a popup window with win_gotoid() 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 23 Apr 2022 15:15:03 +0200
parents 15fd1bae2d57
children 668a94bb0e5e
files src/evalwindow.c src/testdir/test_terminal3.vim src/version.c
diffstat 3 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -817,6 +817,13 @@ f_win_gotoid(typval_T *argvars, typval_T
 	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)
 	{
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -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'
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4814,
+/**/
     4813,
 /**/
     4812,