]> granicus.if.org Git - vim/commitdiff
patch 8.2.0743: can move to another buffer from a terminal in popup window v8.2.0743
authorBram Moolenaar <Bram@vim.org>
Tue, 12 May 2020 20:02:21 +0000 (22:02 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 12 May 2020 20:02:21 +0000 (22:02 +0200)
Problem:    Can move to another buffer from a terminal in popup window.
Solution:   Do not allow "gf" or editing a file. (closes #6072)

src/ex_cmds.c
src/normal.c
src/testdir/test_popupwin.vim
src/version.c

index f38bdacb63a9f795375dae7c95f1ea2f3d563372..9c55de3adf635f1c2da3cd646082a045d81c22b3 100644 (file)
@@ -2484,6 +2484,11 @@ do_ecmd(
     int                did_inc_redrawing_disabled = FALSE;
     long        *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
 
+#ifdef FEAT_PROP_POPUP
+    if (ERROR_IF_TERM_POPUP_WINDOW)
+       return FAIL;
+#endif
+
     if (eap != NULL)
        command = eap->do_ecmd_cmd;
     set_bufref(&old_curbuf, curbuf);
index 7dd74a40bf32f82bb0f3117e0417ab8e76bee570..690bb0081917b23a2eab73de3677a717224fbcd1 100644 (file)
@@ -4169,6 +4169,10 @@ nv_gotofile(cmdarg_T *cap)
        clearop(cap->oap);
        return;
     }
+#ifdef FEAT_PROP_POPUP
+    if (ERROR_IF_TERM_POPUP_WINDOW)
+       return;
+#endif
 
     ptr = grab_file_name(cap->count1, &lnum);
 
index 99b4458250d1fea69a01ca9ca6c223ef9e029c20..5eecb193c115e10d5f5cd93c15dfa7c8c501c8e0 100644 (file)
@@ -2425,8 +2425,16 @@ func Test_popupwin_terminal_buffer()
   call assert_equal(winnr(), winnr('k'))
   call assert_equal(winnr(), winnr('h'))
   call assert_equal(winnr(), winnr('l'))
+
   " Cannot quit while job is running
   call assert_fails('call feedkeys("\<C-W>:quit\<CR>", "xt")', 'E948:')
+
+  " Cannot enter Terminal-Normal mode.
+  call feedkeys("xxx\<C-W>N", 'xt')
+  call assert_fails('call feedkeys("gf", "xt")', 'E863:')
+  call feedkeys("a\<C-U>", 'xt')
+
+  " Exiting shell closes popup window
   call feedkeys("exit\<CR>", 'xt')
   " Wait for shell to exit
   sleep 100m
index 41f857f638e4de13ef1f6bcf94bf2bc56c8a56f3..1ce64b762720d79461628adc2fcf32833759933b 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    743,
 /**/
     742,
 /**/