To: vim_dev@googlegroups.com Subject: Patch 8.2.1997 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1997 Problem: Window changes when using bufload() while in a terminal popup. Solution: When searching for a window by ID also find a popup window. (closes #7307) Files: src/window.c, src/testdir/test_terminal.vim *** ../vim-8.2.1996/src/window.c 2020-11-07 16:58:55.894354883 +0100 --- src/window.c 2020-11-16 20:46:07.291654897 +0100 *************** *** 1462,1467 **** --- 1462,1468 ---- /* * Find window "id" in the current tab page. + * Also find popup windows. * Return NULL if not found. */ win_T * *************** *** 1472,1477 **** --- 1473,1486 ---- FOR_ALL_WINDOWS(wp) if (wp->w_id == id) return wp; + #ifdef FEAT_PROP_POPUP + FOR_ALL_POPUPWINS(wp) + if (wp->w_id == id) + return wp; + FOR_ALL_POPUPWINS_IN_TAB(curtab, wp) + if (wp->w_id == id) + return wp; + #endif return NULL; } *** ../vim-8.2.1996/src/testdir/test_terminal.vim 2020-11-14 21:34:12.253496530 +0100 --- src/testdir/test_terminal.vim 2020-11-16 20:45:42.423696846 +0100 *************** *** 1237,1242 **** --- 1237,1259 ---- unlet s:winid endfunc + func Test_terminal_popup_bufload() + let termbuf = term_start(&shell, #{hidden: v:true, term_finish: 'close'}) + let winid = popup_create(termbuf, {}) + sleep 50m + + let newbuf = bufadd('') + call bufload(newbuf) + call setbufline(newbuf, 1, 'foobar') + + " must not have switched to another window + call assert_equal(winid, win_getid()) + + call feedkeys("exit\", 'xt') + sleep 50m + exe 'bwipe! ' .. newbuf + endfunc + func Test_terminal_popup_insert_cmd() CheckUnix *** ../vim-8.2.1996/src/version.c 2020-11-16 20:08:32.399713936 +0100 --- src/version.c 2020-11-16 20:46:47.883585418 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1997, /**/ -- hundred-and-one symptoms of being an internet addict: 256. You are able to write down over 250 symptoms of being an internet addict, even though they only asked for 101. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///