mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0791: a second popup window with terminal causes trouble
Problem: A second popup window with terminal causes trouble. Solution: Disallow opening a second terminal-popup window. (closes #6101, closes #6103) Avoid defaulting to an invalid line number.
This commit is contained in:
@@ -1757,6 +1757,25 @@ add_border_left_right_padding(win_T *wp)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if there is any popup window with a terminal buffer.
|
||||
*/
|
||||
static int
|
||||
popup_terminal_exists(void)
|
||||
{
|
||||
win_T *wp;
|
||||
tabpage_T *tp;
|
||||
|
||||
FOR_ALL_POPUPWINS(wp)
|
||||
if (wp->w_buffer->b_term != NULL)
|
||||
return TRUE;
|
||||
FOR_ALL_TABPAGES(tp)
|
||||
FOR_ALL_POPUPWINS_IN_TAB(tp, wp)
|
||||
if (wp->w_buffer->b_term != NULL)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* popup_create({text}, {options})
|
||||
* popup_atcursor({text}, {options})
|
||||
@@ -1786,6 +1805,13 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
|
||||
semsg(_(e_nobufnr), argvars[0].vval.v_number);
|
||||
return NULL;
|
||||
}
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (buf->b_term != NULL && popup_terminal_exists())
|
||||
{
|
||||
emsg(_("E861: Cannot open a second popup with a terminal"));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (!(argvars[0].v_type == VAR_STRING
|
||||
&& argvars[0].vval.v_string != NULL)
|
||||
|
Reference in New Issue
Block a user