summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-18 22:35:30 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-18 22:35:30 +0100
commit2c90d51123fba44a90e09aa4a4f2b7d972dadb94 (patch)
tree8eb792f2c67077f20581d81eb41f6344a57e2dca /src/testdir
parentaab93b12cb54fbe5efe9e8f6fde1c46802a3031e (diff)
downloadvim-git-2c90d51123fba44a90e09aa4a4f2b7d972dadb94.tar.gz
patch 8.0.0482: the setbufvar() function may mess up the window layoutv8.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.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_functions.vim31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index e2a4e8c7d..228e7ab43 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -725,3 +725,34 @@ func Test_balloon_show()
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