To: vim_dev@googlegroups.com Subject: Patch 8.0.0482 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0482 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. Files: src/window.c, src/testdir/test_functions.vim *** ../vim-8.0.0481/src/window.c 2017-03-12 19:22:31.772584816 +0100 --- src/window.c 2017-03-18 22:32:29.032748508 +0100 *************** *** 6563,6569 **** && check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL) || (sn->fr_child != NULL && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL) ! || !win_valid(sn->fr_win)) return FAIL; return OK; } --- 6563,6569 ---- && check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL) || (sn->fr_child != NULL && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL) ! || (sn->fr_win != NULL && !win_valid(sn->fr_win))) return FAIL; return OK; } *** ../vim-8.0.0481/src/testdir/test_functions.vim 2017-03-13 20:37:11.445776655 +0100 --- src/testdir/test_functions.vim 2017-03-18 22:29:35.742040736 +0100 *************** *** 725,727 **** --- 725,758 ---- call balloon_show('hi!') endif 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 *** ../vim-8.0.0481/src/version.c 2017-03-18 21:37:23.865273985 +0100 --- src/version.c 2017-03-18 22:31:58.340977178 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 482, /**/ -- hundred-and-one symptoms of being an internet addict: 157. You fum through a magazine, you first check to see if it has a web address. /// Bram Moolenaar -- Bram@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 ///