{
wininfo_T *wip;
+ // The b_wininfo list should have the windows that recently contained the
+ // buffer, going over this is faster than going over all the windows.
+ // Do check the buffer is still there.
FOR_ALL_BUF_WININFO(curbuf, wip)
{
- if (wip->wi_win != NULL)
+ if (wip->wi_win != NULL && wip->wi_win->w_buffer == curbuf)
{
curwin = wip->wi_win;
break;
bwipe!
endfunc
+func Test_deletebufline_popup_window()
+ let popupID = popup_create('foo', {})
+ let bufnr = winbufnr(popupID)
+
+ " Check that deletebufline() brings us back to the same window.
+ new
+ let winid_before = win_getid()
+ call deletebufline(bufnr, 1, '$')
+ call assert_equal(winid_before, win_getid())
+ bwipe
+
+ call popup_close(popupID)
+endfunc
+
func Test_setbufline_startup_nofile()
let before =<< trim [CODE]
set shortmess+=F