mirror of
https://github.com/vim/vim.git
synced 2025-10-13 06:54:15 -04:00
patch 8.2.0204: crash when using winnr('j') in a popup window
Problem: Crash when using winnr('j') in a popup window. Solution: Do not search for neighbors in a popup window. (closes #5568)
This commit is contained in:
@@ -332,8 +332,6 @@ get_winnr(tabpage_T *tp, typval_T *argvar)
|
|||||||
else if (STRCMP(arg, "#") == 0)
|
else if (STRCMP(arg, "#") == 0)
|
||||||
{
|
{
|
||||||
twin = (tp == curtab) ? prevwin : tp->tp_prevwin;
|
twin = (tp == curtab) ? prevwin : tp->tp_prevwin;
|
||||||
if (twin == NULL)
|
|
||||||
nr = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -360,6 +358,8 @@ get_winnr(tabpage_T *tp, typval_T *argvar)
|
|||||||
else
|
else
|
||||||
invalid_arg = TRUE;
|
invalid_arg = TRUE;
|
||||||
}
|
}
|
||||||
|
if (twin == NULL)
|
||||||
|
nr = 0;
|
||||||
|
|
||||||
if (invalid_arg)
|
if (invalid_arg)
|
||||||
{
|
{
|
||||||
|
@@ -2400,9 +2400,14 @@ func Test_popupwin_terminal_buffer()
|
|||||||
|
|
||||||
let origwin = win_getid()
|
let origwin = win_getid()
|
||||||
let ptybuf = term_start(&shell, #{hidden: 1})
|
let ptybuf = term_start(&shell, #{hidden: 1})
|
||||||
let winnr = popup_create(ptybuf, #{minwidth: 40, minheight: 10})
|
let winid = popup_create(ptybuf, #{minwidth: 40, minheight: 10})
|
||||||
" Wait for shell to start
|
" Wait for shell to start
|
||||||
sleep 200m
|
sleep 200m
|
||||||
|
" Check this doesn't crash
|
||||||
|
call assert_equal(winnr(), winnr('j'))
|
||||||
|
call assert_equal(winnr(), winnr('k'))
|
||||||
|
call assert_equal(winnr(), winnr('h'))
|
||||||
|
call assert_equal(winnr(), winnr('l'))
|
||||||
" Cannot quit while job is running
|
" Cannot quit while job is running
|
||||||
call assert_fails('call feedkeys("\<C-W>:quit\<CR>", "xt")', 'E948:')
|
call assert_fails('call feedkeys("\<C-W>:quit\<CR>", "xt")', 'E948:')
|
||||||
call feedkeys("exit\<CR>", 'xt')
|
call feedkeys("exit\<CR>", 'xt')
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
204,
|
||||||
/**/
|
/**/
|
||||||
203,
|
203,
|
||||||
/**/
|
/**/
|
||||||
|
10
src/window.c
10
src/window.c
@@ -4431,6 +4431,11 @@ win_vert_neighbor(tabpage_T *tp, win_T *wp, int up, long count)
|
|||||||
frame_T *nfr;
|
frame_T *nfr;
|
||||||
frame_T *foundfr;
|
frame_T *foundfr;
|
||||||
|
|
||||||
|
#ifdef FEAT_PROP_POPUP
|
||||||
|
if (popup_is_popup(wp))
|
||||||
|
// popups don't have neighbors.
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
foundfr = wp->w_frame;
|
foundfr = wp->w_frame;
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
@@ -4513,6 +4518,11 @@ win_horz_neighbor(tabpage_T *tp, win_T *wp, int left, long count)
|
|||||||
frame_T *nfr;
|
frame_T *nfr;
|
||||||
frame_T *foundfr;
|
frame_T *foundfr;
|
||||||
|
|
||||||
|
#ifdef FEAT_PROP_POPUP
|
||||||
|
if (popup_is_popup(wp))
|
||||||
|
// popups don't have neighbors.
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
foundfr = wp->w_frame;
|
foundfr = wp->w_frame;
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user