summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-01 23:04:24 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-01 23:04:24 +0100
commit3c01c4a02897163996639f6f2604c68eab2bd18b (patch)
tree165e15670745d97aefa14938a2ea695acfa7327c
parent284d1c24e250494cf886b3548f1ecae5ad262da9 (diff)
downloadvim-git-3c01c4a02897163996639f6f2604c68eab2bd18b.tar.gz
patch 8.2.0194: some commands can cause problems in terminal popupv8.2.0194
Problem: Some commands can cause problems in terminal popup. Solution: Disallow more commands.
-rw-r--r--src/arglist.c2
-rw-r--r--src/ex_docmd.c17
-rw-r--r--src/macros.h4
-rw-r--r--src/popupwin.c8
-rw-r--r--src/proto/popupwin.pro2
-rw-r--r--src/testdir/test_terminal.vim2
-rw-r--r--src/version.c2
-rw-r--r--src/window.c10
8 files changed, 26 insertions, 21 deletions
diff --git a/src/arglist.c b/src/arglist.c
index 942da86c2..ad404d8ae 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -638,7 +638,7 @@ do_argfile(exarg_T *eap, int argn)
char_u *p;
int old_arg_idx = curwin->w_arg_idx;
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
if (argn < 0 || argn >= ARGCOUNT)
{
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 80cc9307c..645ad0c93 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4633,7 +4633,7 @@ ex_doautocmd(exarg_T *eap)
static void
ex_bunload(exarg_T *eap)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
eap->errmsg = do_bufdel(
eap->cmdidx == CMD_bdelete ? DOBUF_DEL
@@ -4649,7 +4649,7 @@ ex_bunload(exarg_T *eap)
static void
ex_buffer(exarg_T *eap)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
if (*eap->arg)
eap->errmsg = e_trailing;
@@ -4683,7 +4683,7 @@ ex_bmodified(exarg_T *eap)
static void
ex_bnext(exarg_T *eap)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2);
@@ -4700,7 +4700,7 @@ ex_bnext(exarg_T *eap)
static void
ex_bprevious(exarg_T *eap)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2);
@@ -4717,7 +4717,7 @@ ex_bprevious(exarg_T *eap)
static void
ex_brewind(exarg_T *eap)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
@@ -4732,7 +4732,7 @@ ex_brewind(exarg_T *eap)
static void
ex_blast(exarg_T *eap)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
goto_buffer(eap, DOBUF_LAST, BACKWARD, 0);
@@ -5762,7 +5762,7 @@ ex_splitview(exarg_T *eap)
|| eap->cmdidx == CMD_tabfind
|| eap->cmdidx == CMD_tabnew;
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
#ifdef FEAT_GUI
@@ -6145,7 +6145,8 @@ do_exedit(
int need_hide;
int exmode_was = exmode_active;
- if (eap->cmdidx != CMD_pedit && ERROR_IF_POPUP_WINDOW)
+ if ((eap->cmdidx != CMD_pedit && ERROR_IF_POPUP_WINDOW)
+ || ERROR_IF_TERM_POPUP_WINDOW)
return;
/*
* ":vi" command ends Ex mode.
diff --git a/src/macros.h b/src/macros.h
index 68e3f9756..b71946288 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -344,9 +344,11 @@
// Give an error in curwin is a popup window and evaluate to TRUE.
#ifdef FEAT_PROP_POPUP
-# define ERROR_IF_POPUP_WINDOW error_if_popup_window()
+# define ERROR_IF_POPUP_WINDOW error_if_popup_window(FALSE)
+# define ERROR_IF_ANY_POPUP_WINDOW error_if_popup_window(TRUE)
#else
# define ERROR_IF_POPUP_WINDOW 0
+# define ERROR_IF_ANY_POPUP_WINDOW 0
#endif
#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
# define ERROR_IF_TERM_POPUP_WINDOW error_if_term_popup_window()
diff --git a/src/popupwin.c b/src/popupwin.c
index cb33dc483..d4f6026f9 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2360,7 +2360,7 @@ f_popup_close(typval_T *argvars, typval_T *rettv UNUSED)
int id = (int)tv_get_number(argvars);
win_T *wp;
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
wp = find_popup_win(id);
@@ -2511,7 +2511,7 @@ popup_close_tabpage(tabpage_T *tp, int id)
void
close_all_popups(void)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
while (first_popupwin != NULL)
popup_close(first_popupwin->w_id);
@@ -2845,14 +2845,14 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv)
}
int
-error_if_popup_window()
+error_if_popup_window(int also_with_term UNUSED)
{
// win_execute() may set "curwin" to a popup window temporarily, but many
// commands are disallowed then. When a terminal runs in the popup most
// things are allowed.
if (WIN_IS_POPUP(curwin)
# ifdef FEAT_TERMINAL
- && curbuf->b_term == NULL
+ && (also_with_term || curbuf->b_term == NULL)
# endif
)
{
diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro
index bfbd883ca..7608f32a2 100644
--- a/src/proto/popupwin.pro
+++ b/src/proto/popupwin.pro
@@ -41,7 +41,7 @@ void f_popup_setoptions(typval_T *argvars, typval_T *rettv);
void f_popup_getpos(typval_T *argvars, typval_T *rettv);
void f_popup_locate(typval_T *argvars, typval_T *rettv);
void f_popup_getoptions(typval_T *argvars, typval_T *rettv);
-int error_if_popup_window(void);
+int error_if_popup_window(int also_with_term);
int error_if_term_popup_window(void);
void popup_reset_handled(int handled_flag);
win_T *find_next_popup(int lowest, int handled_flag);
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 00f0bfe49..7fda9f65b 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2357,7 +2357,7 @@ func Test_terminal_in_popup()
call VerifyScreenDump(buf, 'Test_terminal_popup_3', {})
call term_sendkeys(buf, ":q\<CR>")
- call term_wait(buf, 50) " wait for terminal to vanish
+ call term_wait(buf, 100) " wait for terminal to vanish
call StopVimInTerminal(buf)
call delete('XtermPopup')
diff --git a/src/version.c b/src/version.c
index 657e1376a..549c78c8b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 194,
+/**/
193,
/**/
192,
diff --git a/src/window.c b/src/window.c
index 6317c3747..aeafb267c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -122,7 +122,7 @@ do_window(
#endif
char_u cbuf[40];
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
#ifdef FEAT_CMDWIN
@@ -784,7 +784,7 @@ check_split_disallowed()
int
win_split(int size, int flags)
{
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return FAIL;
// When the ":tab" modifier was used open a new tab page instead.
@@ -1574,7 +1574,7 @@ win_exchange(long Prenum)
win_T *wp2;
int temp;
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
if (ONE_WINDOW) // just one window
{
@@ -2441,7 +2441,7 @@ win_close(win_T *win, int free_buf)
int had_diffmode = win->w_p_diff;
#endif
- if (ERROR_IF_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return FAIL;
if (last_window())
@@ -4344,7 +4344,7 @@ win_goto(win_T *wp)
#endif
#ifdef FEAT_PROP_POPUP
- if (ERROR_IF_POPUP_WINDOW || ERROR_IF_TERM_POPUP_WINDOW)
+ if (ERROR_IF_ANY_POPUP_WINDOW)
return;
if (popup_is_popup(wp))
{