1
0
forked from aniani/vim

patch 8.2.1591: using winheight('.') in tests works but is wrong

Problem:    Using winheight('.') in tests works but is wrong.
Solution:   Use winheight(0). (issue #6863)
This commit is contained in:
Bram Moolenaar
2020-09-04 18:38:06 +02:00
parent fe136c9a85
commit c05d1c043a
3 changed files with 8 additions and 6 deletions

View File

@@ -1438,19 +1438,19 @@ func Test_setbufvar_options()
let prev_id = win_getid() let prev_id = win_getid()
wincmd j wincmd j
let wh = winheight('.') let wh = winheight(0)
let dummy_buf = bufnr('dummy_buf1', v:true) let dummy_buf = bufnr('dummy_buf1', v:true)
call setbufvar(dummy_buf, '&buftype', 'nofile') call setbufvar(dummy_buf, '&buftype', 'nofile')
execute 'belowright vertical split #' . dummy_buf execute 'belowright vertical split #' . dummy_buf
call assert_equal(wh, winheight('.')) call assert_equal(wh, winheight(0))
let dum1_id = win_getid() let dum1_id = win_getid()
wincmd h wincmd h
let wh = winheight('.') let wh = winheight(0)
let dummy_buf = bufnr('dummy_buf2', v:true) let dummy_buf = bufnr('dummy_buf2', v:true)
eval 'nofile'->setbufvar(dummy_buf, '&buftype') eval 'nofile'->setbufvar(dummy_buf, '&buftype')
execute 'belowright vertical split #' . dummy_buf execute 'belowright vertical split #' . dummy_buf
call assert_equal(wh, winheight('.')) call assert_equal(wh, winheight(0))
bwipe! bwipe!
call win_gotoid(prev_id) call win_gotoid(prev_id)

View File

@@ -261,13 +261,13 @@ func XwindowTests(cchar)
" Open the window " Open the window
Xopen 5 Xopen 5
call assert_true(winnr('$') == 2 && getline('.') ==# '|| non-error 1' call assert_true(winnr('$') == 2 && getline('.') ==# '|| non-error 1'
\ && winheight('.') == 5) \ && winheight(0) == 5)
" Opening the window again, should move the cursor to that window " Opening the window again, should move the cursor to that window
wincmd t wincmd t
Xopen 7 Xopen 7
call assert_true(winnr('$') == 2 && winnr() == 2 && call assert_true(winnr('$') == 2 && winnr() == 2 &&
\ winheight('.') == 7 && \ winheight(0) == 7 &&
\ getline('.') ==# '|| non-error 1') \ getline('.') ==# '|| non-error 1')
" :cnext in quickfix window should move to the next entry " :cnext in quickfix window should move to the next entry

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1591,
/**/ /**/
1590, 1590,
/**/ /**/