Patch 8.2.2631

12 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 20, 2021, 2:56:13 PM3/20/21
to vim...@googlegroups.com

Patch 8.2.2631
Problem: Commands from winrestcmd() do not always work properly. (Leonid V.
Fedorenchik)
Solution: Repeat the size commands twice. (closes #7988)
Files: src/evalwindow.c, src/testdir/test_window_cmd.vim


*** ../vim-8.2.2630/src/evalwindow.c 2021-01-12 22:08:50.087871728 +0100
--- src/evalwindow.c 2021-03-20 19:54:40.612552378 +0100
***************
*** 1007,1024 ****
f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv)
{
win_T *wp;
! int winnr = 1;
garray_T ga;
char_u buf[50];

ga_init2(&ga, (int)sizeof(char), 70);
! FOR_ALL_WINDOWS(wp)
{
! sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height);
! ga_concat(&ga, buf);
! sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width);
! ga_concat(&ga, buf);
! ++winnr;
}
ga_append(&ga, NUL);

--- 1007,1031 ----
f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv)
{
win_T *wp;
! int i;
! int winnr;
garray_T ga;
char_u buf[50];

ga_init2(&ga, (int)sizeof(char), 70);
!
! // Do this twice to handle some window layouts properly.
! for (i = 0; i < 2; ++i)
{
! winnr = 1;
! FOR_ALL_WINDOWS(wp)
! {
! sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height);
! ga_concat(&ga, buf);
! sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width);
! ga_concat(&ga, buf);
! ++winnr;
! }
}
ga_append(&ga, NUL);

*** ../vim-8.2.2630/src/testdir/test_window_cmd.vim 2021-01-28 13:47:55.060905101 +0100
--- src/testdir/test_window_cmd.vim 2021-03-20 19:35:48.551895283 +0100
***************
*** 631,646 ****
func Test_winrestcmd()
2split
3vsplit
! let a = winrestcmd()
call assert_equal(2, winheight(0))
call assert_equal(3, winwidth(0))
wincmd =
call assert_notequal(2, winheight(0))
call assert_notequal(3, winwidth(0))
! exe a
call assert_equal(2, winheight(0))
call assert_equal(3, winwidth(0))
only
endfunc

func Fun_RenewFile()
--- 631,659 ----
func Test_winrestcmd()
2split
3vsplit
! let restcmd = winrestcmd()
call assert_equal(2, winheight(0))
call assert_equal(3, winwidth(0))
wincmd =
call assert_notequal(2, winheight(0))
call assert_notequal(3, winwidth(0))
! exe restcmd
call assert_equal(2, winheight(0))
call assert_equal(3, winwidth(0))
only
+
+ wincmd v
+ wincmd s
+ wincmd v
+ redraw
+ let restcmd = winrestcmd()
+ wincmd _
+ wincmd |
+ exe restcmd
+ redraw
+ call assert_equal(restcmd, winrestcmd())
+
+ only
endfunc

func Fun_RenewFile()
*** ../vim-8.2.2630/src/version.c 2021-03-20 16:44:22.491927605 +0100
--- src/version.c 2021-03-20 19:21:22.578244216 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2631,
/**/

--
hundred-and-one symptoms of being an internet addict:
3. Your bookmark takes 15 minutes to scroll from top to bottom.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages