vim-patch:8.2.1856: "2resize" uses size of current window

Problem:    "2resize" uses size of current window.
Solution:   Use size of resized window. (Yasuhiro Matsumoto, closes vim/vim#7152)
9668cc57a1
This commit is contained in:
Jan Edmund Lazo
2020-10-17 12:14:14 -04:00
parent c8ce098e71
commit e1ec2b0729
2 changed files with 6 additions and 2 deletions

View File

@@ -7138,14 +7138,14 @@ static void ex_resize(exarg_T *eap)
n = atol((char *)eap->arg); n = atol((char *)eap->arg);
if (cmdmod.split & WSP_VERT) { if (cmdmod.split & WSP_VERT) {
if (*eap->arg == '-' || *eap->arg == '+') { if (*eap->arg == '-' || *eap->arg == '+') {
n += curwin->w_width; n += wp->w_width;
} else if (n == 0 && eap->arg[0] == NUL) { // default is very wide } else if (n == 0 && eap->arg[0] == NUL) { // default is very wide
n = Columns; n = Columns;
} }
win_setwidth_win(n, wp); win_setwidth_win(n, wp);
} else { } else {
if (*eap->arg == '-' || *eap->arg == '+') { if (*eap->arg == '-' || *eap->arg == '+') {
n += curwin->w_height; n += wp->w_height;
} else if (n == 0 && eap->arg[0] == NUL) { // default is very high } else if (n == 0 && eap->arg[0] == NUL) { // default is very high
n = Rows-1; n = Rows-1;
} }

View File

@@ -879,6 +879,10 @@ func Test_window_resize()
exe other_winnr .. 'resize 10' exe other_winnr .. 'resize 10'
call assert_equal(10, winheight(other_winnr)) call assert_equal(10, winheight(other_winnr))
call assert_equal(&lines - 10 - 3, winheight(0)) call assert_equal(&lines - 10 - 3, winheight(0))
exe other_winnr .. 'resize +1'
exe other_winnr .. 'resize +1'
call assert_equal(12, winheight(other_winnr))
call assert_equal(&lines - 10 - 3 -2, winheight(0))
%bwipe! %bwipe!
endfunc endfunc