To: vim_dev@googlegroups.com Subject: Patch 9.0.0824 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0824 Problem: Crash when using win_move_separator() in other tab page. Solution: Check for valid window in current tab page. (closes #11479, closes #11427) Files: src/evalwindow.c, src/testdir/test_mapping.vim, src/testdir/test_window_cmd.vim *** ../vim-9.0.0823/src/evalwindow.c 2022-10-31 12:24:04.098680850 +0000 --- src/evalwindow.c 2022-11-01 11:36:28.838371162 +0000 *************** *** 889,894 **** --- 889,899 ---- wp = find_win_by_nr_or_id(&argvars[0]); if (wp == NULL || win_valid_popup(wp)) return; + if (!win_valid(wp)) + { + emsg(_(e_cannot_resize_window_in_another_tab_page)); + return; + } offset = (int)tv_get_number(&argvars[1]); win_drag_vsep_line(wp, offset); *** ../vim-9.0.0823/src/testdir/test_mapping.vim 2022-10-31 13:04:59.497449003 +0000 --- src/testdir/test_mapping.vim 2022-11-01 11:36:28.838371162 +0000 *************** *** 1652,1669 **** set laststatus=2 set mouse=a func ClickExpr() ! call test_setmouse(&lines - 1, 1) ! return "\" endfunc func DragExpr() ! call test_setmouse(&lines - 2, 1) ! return "\" endfunc nnoremap ClickExpr() nnoremap DragExpr() " this was causing a crash in win_drag_status_line() call feedkeys("\:tabnew\\", 'tx') endfunc " Test for mapping in Insert mode --- 1652,1675 ---- set laststatus=2 set mouse=a func ClickExpr() ! call test_setmouse(&lines - 1, 1) ! return "\" endfunc func DragExpr() ! call test_setmouse(&lines - 2, 1) ! return "\" endfunc nnoremap ClickExpr() nnoremap DragExpr() " this was causing a crash in win_drag_status_line() call feedkeys("\:tabnew\\", 'tx') + + nunmap + nunmap + delfunc ClickExpr + delfunc DragExpr + set laststatus& mouse& endfunc " Test for mapping in Insert mode *** ../vim-9.0.0823/src/testdir/test_window_cmd.vim 2022-10-31 12:24:04.098680850 +0000 --- src/testdir/test_window_cmd.vim 2022-11-01 11:36:28.838371162 +0000 *************** *** 1483,1505 **** --- 1483,1515 ---- call assert_equal(w0, winwidth(0)) call assert_true(win_move_separator(0, -1)) call assert_equal(w0, winwidth(0)) + " check that win_move_separator doesn't error with offsets beyond moving " possibility call assert_true(win_move_separator(id, 5000)) call assert_true(winwidth(id) > w) call assert_true(win_move_separator(id, -5000)) call assert_true(winwidth(id) < w) + " check that win_move_separator returns false for an invalid window wincmd = let w = winwidth(0) call assert_false(win_move_separator(-1, 1)) call assert_equal(w, winwidth(0)) + " check that win_move_separator returns false for a popup window let id = popup_create(['hello', 'world'], {}) let w = winwidth(id) call assert_false(win_move_separator(id, 1)) call assert_equal(w, winwidth(id)) call popup_close(id) + + " check that using another tabpage fails without crash + let id = win_getid() + tabnew + call assert_fails('call win_move_separator(id, -1)', 'E1308:') + tabclose + %bwipe! endfunc *** ../vim-9.0.0823/src/version.c 2022-10-31 23:06:52.004079731 +0000 --- src/version.c 2022-11-01 11:40:01.814452083 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 824, /**/ -- The average life of an organization chart is six months. You can safely ignore any order from your boss that would take six months to complete. (Scott Adams - The Dilbert principle) /// 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 ///