0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.0.0482: the setbufvar() function may mess up the window layout

Problem:    The setbufvar() function may mess up the window layout. (Kay Z.)
Solution:   Do not check the window to be valid if it is NULL.
This commit is contained in:
Bram Moolenaar
2017-03-18 22:35:30 +01:00
parent aab93b12cb
commit 2c90d51123
3 changed files with 34 additions and 1 deletions

View File

@@ -725,3 +725,34 @@ func Test_balloon_show()
call balloon_show('hi!') call balloon_show('hi!')
endif endif
endfunc endfunc
func Test_setbufvar_options()
" This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the
" window layout.
call assert_equal(1, winnr('$'))
split dummy_preview
resize 2
set winfixheight winfixwidth
let prev_id = win_getid()
wincmd j
let wh = winheight('.')
let dummy_buf = bufnr('dummy_buf1', v:true)
call setbufvar(dummy_buf, '&buftype', 'nofile')
execute 'belowright vertical split #' . dummy_buf
call assert_equal(wh, winheight('.'))
let dum1_id = win_getid()
wincmd h
let wh = winheight('.')
let dummy_buf = bufnr('dummy_buf2', v:true)
call setbufvar(dummy_buf, '&buftype', 'nofile')
execute 'belowright vertical split #' . dummy_buf
call assert_equal(wh, winheight('.'))
bwipe!
call win_gotoid(prev_id)
bwipe!
call win_gotoid(dum1_id)
bwipe!
endfunc

View File

@@ -764,6 +764,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 */
/**/
482,
/**/ /**/
481, 481,
/**/ /**/

View File

@@ -6563,7 +6563,7 @@ check_snapshot_rec(frame_T *sn, frame_T *fr)
&& check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL) && check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL)
|| (sn->fr_child != NULL || (sn->fr_child != NULL
&& check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL) && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL)
|| !win_valid(sn->fr_win)) || (sn->fr_win != NULL && !win_valid(sn->fr_win)))
return FAIL; return FAIL;
return OK; return OK;
} }