To: vim_dev@googlegroups.com Subject: Patch 8.2.0204 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0204 Problem: Crash when using winnr('j') in a popup window. Solution: Do not search for neighbors in a popup window. (closes #5568) Files: src/window.c, src/testdir/test_popupwin.vim, src/evalwindow.c *** ../vim-8.2.0203/src/window.c 2020-02-02 15:25:10.097976117 +0100 --- src/window.c 2020-02-03 21:53:43.407396658 +0100 *************** *** 4431,4436 **** --- 4431,4441 ---- frame_T *nfr; frame_T *foundfr; + #ifdef FEAT_PROP_POPUP + if (popup_is_popup(wp)) + // popups don't have neighbors. + return NULL; + #endif foundfr = wp->w_frame; while (count--) { *************** *** 4513,4518 **** --- 4518,4528 ---- frame_T *nfr; frame_T *foundfr; + #ifdef FEAT_PROP_POPUP + if (popup_is_popup(wp)) + // popups don't have neighbors. + return NULL; + #endif foundfr = wp->w_frame; while (count--) { *** ../vim-8.2.0203/src/testdir/test_popupwin.vim 2020-02-02 15:25:10.097976117 +0100 --- src/testdir/test_popupwin.vim 2020-02-03 21:57:41.110635672 +0100 *************** *** 2400,2408 **** let origwin = win_getid() let ptybuf = term_start(&shell, #{hidden: 1}) ! let winnr = popup_create(ptybuf, #{minwidth: 40, minheight: 10}) " Wait for shell to start sleep 200m " Cannot quit while job is running call assert_fails('call feedkeys("\:quit\", "xt")', 'E948:') call feedkeys("exit\", 'xt') --- 2400,2413 ---- let origwin = win_getid() let ptybuf = term_start(&shell, #{hidden: 1}) ! let winid = popup_create(ptybuf, #{minwidth: 40, minheight: 10}) " Wait for shell to start 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 call assert_fails('call feedkeys("\:quit\", "xt")', 'E948:') call feedkeys("exit\", 'xt') *** ../vim-8.2.0203/src/evalwindow.c 2020-01-14 19:05:34.049710485 +0100 --- src/evalwindow.c 2020-02-03 21:59:14.498326702 +0100 *************** *** 332,339 **** else if (STRCMP(arg, "#") == 0) { twin = (tp == curtab) ? prevwin : tp->tp_prevwin; - if (twin == NULL) - nr = 0; } else { --- 332,337 ---- *************** *** 360,365 **** --- 358,365 ---- else invalid_arg = TRUE; } + if (twin == NULL) + nr = 0; if (invalid_arg) { *** ../vim-8.2.0203/src/version.c 2020-02-03 21:40:00.005363654 +0100 --- src/version.c 2020-02-03 22:14:53.278809580 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 204, /**/ -- How To Keep A Healthy Level Of Insanity: 14. Put mosquito netting around your work area. Play a tape of jungle sounds all day. /// 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 ///