To: vim_dev@googlegroups.com Subject: Patch 9.0.0961 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0961 Problem: Using deletebufline() may jump to another window. Solution: Do not use a window where the buffer was only in the past. (closes #11594) Files: src/evalbuffer.c, src/testdir/test_bufline.vim *** ../vim-9.0.0960/src/evalbuffer.c 2022-11-21 19:56:59.403412744 +0000 --- src/evalbuffer.c 2022-11-27 19:37:48.341094310 +0000 *************** *** 109,117 **** { wininfo_T *wip; FOR_ALL_BUF_WININFO(curbuf, wip) { ! if (wip->wi_win != NULL) { curwin = wip->wi_win; break; --- 109,120 ---- { 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 && wip->wi_win->w_buffer == curbuf) { curwin = wip->wi_win; break; *** ../vim-9.0.0960/src/testdir/test_bufline.vim 2022-11-21 19:56:59.403412744 +0000 --- src/testdir/test_bufline.vim 2022-11-27 19:30:22.429475875 +0000 *************** *** 288,293 **** --- 288,307 ---- 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 *** ../vim-9.0.0960/src/version.c 2022-11-27 16:18:30.267345906 +0000 --- src/version.c 2022-11-27 19:31:38.050297301 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 961, /**/ -- You're as much use as a condom machine at the Vatican. -- Rimmer to Holly in Red Dwarf 'Queeg' /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///