patch 8.1.1433: win_execute() may leave popup window focused
Problem: Win_execute() may leave popup window focused, eventually leading
to a crash. (Bjorn Linse)
Solution: When previous window was closed, go to the first window.
This commit is contained in:
@ -105,6 +105,14 @@ func Test_popup_with_syntax_setbufvar()
|
||||
call delete('XtestPopup')
|
||||
endfunc
|
||||
|
||||
func Test_win_execute_closing_curwin()
|
||||
split
|
||||
let winid = popup_create('some text', {})
|
||||
call win_execute(winid, winnr() .. "close")
|
||||
call assert_equal(1, winnr())
|
||||
popupclear
|
||||
endfunc
|
||||
|
||||
func Test_popup_with_wrap()
|
||||
if !CanRunVimInTerminal()
|
||||
return
|
||||
|
||||
@ -767,6 +767,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1433,
|
||||
/**/
|
||||
1432,
|
||||
/**/
|
||||
|
||||
@ -6573,6 +6573,12 @@ restore_win_noblock(
|
||||
curwin = save_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
}
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
else if (bt_popup(curwin->w_buffer))
|
||||
// original window was closed and now we're in a popup window: Go
|
||||
// to the first valid window.
|
||||
win_goto(firstwin);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user