Patch 9.0.0821

20 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 31, 2022, 8:36:13 AM10/31/22
to vim...@googlegroups.com

[ The git commit somehow ended up with the description of the previous
patch. Still waiting for someone to give me the git commands to fix
these things. Hopefully it will work OK from here forward! ]

Patch 9.0.0821
Problem: Crash when using win_move_statusline() in another tab page.
Solution: Check for valid window pointer. (issue #11427)
Files: src/evalwindow.c, src/errors.h, src/testdir/test_window_cmd.vim


*** ../vim-9.0.0819/src/evalwindow.c 2022-10-04 16:23:39.010042185 +0100
--- src/evalwindow.c 2022-10-31 12:16:00.289874227 +0000
***************
*** 914,919 ****
--- 914,924 ----
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_status_line(wp, offset);
*** ../vim-9.0.0819/src/errors.h 2022-10-13 22:12:07.164673822 +0100
--- src/errors.h 2022-10-31 12:15:45.101843977 +0000
***************
*** 3330,3333 ****
--- 3330,3335 ----
INIT(= N_("E1306: Loop nesting too deep"));
EXTERN char e_argument_nr_trying_to_modify_const_str[]
INIT(= N_("E1307: Argument %d: Trying to modify a const %s"));
+ EXTERN char e_cannot_resize_window_in_another_tab_page[]
+ INIT(= N_("E1308: Cannot resize a window in another tab page"));
#endif
*** ../vim-9.0.0819/src/testdir/test_window_cmd.vim 2022-10-15 22:06:02.730483280 +0100
--- src/testdir/test_window_cmd.vim 2022-10-31 12:21:14.062424977 +0000
***************
*** 1545,1567 ****
--- 1545,1577 ----
call assert_true(id->win_move_statusline(-offset))
call assert_equal(h, winheight(id))
endfor
+
" check that win_move_statusline doesn't error with offsets beyond moving
" possibility
call assert_true(win_move_statusline(id, 5000))
call assert_true(winheight(id) > h)
call assert_true(win_move_statusline(id, -5000))
call assert_true(winheight(id) < h)
+
" check that win_move_statusline returns false for an invalid window
wincmd =
let h = winheight(0)
call assert_false(win_move_statusline(-1, 1))
call assert_equal(h, winheight(0))
+
" check that win_move_statusline returns false for a popup window
let id = popup_create(['hello', 'world'], {})
let h = winheight(id)
call assert_false(win_move_statusline(id, 1))
call assert_equal(h, winheight(id))
call popup_close(id)
+
+ " check that using another tabpage fails without crash
+ let id = win_getid()
+ tabnew
+ call assert_fails('call win_move_statusline(id, -1)', 'E1308:')
+ tabclose
+
%bwipe!
endfunc

*** ../vim-9.0.0819/src/version.c 2022-10-31 12:23:47.522656875 +0000
--- src/version.c 2022-10-31 12:18:57.242200210 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 821,
/**/

--
Imagine a world without hypothetical situations.

/// Bram Moolenaar -- Br...@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 ///

7to...@gmail.com

unread,
Nov 1, 2022, 1:53:34 PM11/1/22
to vim_dev
On Monday, October 31, 2022 at 1:36:13 PM UTC+1 Bram Moolenaar wrote:

[ The git commit somehow ended up with the description of the previous
patch. Still waiting for someone to give me the git commands to fix
these things. Hopefully it will work OK from here forward! ]

In git you can't change the message (or anything else) of an existing commit. You can't change history. You can only rewrite it. Which means to discard it and write a new one. But then people would have to discard the old history and pull the new one too.

Tom M

Reply all
Reply to author
Forward
0 new messages