Mercurial > vim
comparison src/testdir/test_functions.vim @ 11191:445fd6be2009 v8.0.0482
patch 8.0.0482: the setbufvar() function may mess up the window layout
commit https://github.com/vim/vim/commit/2c90d51123fba44a90e09aa4a4f2b7d972dadb94
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 18 22:35:30 2017 +0100
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 18 Mar 2017 22:45:05 +0100 |
parents | c4e4387bbd50 |
children | 7f355d8cd634 |
comparison
equal
deleted
inserted
replaced
11190:c175764745a0 | 11191:445fd6be2009 |
---|---|
723 if has('balloon_eval') | 723 if has('balloon_eval') |
724 " This won't do anything but must not crash either. | 724 " This won't do anything but must not crash either. |
725 call balloon_show('hi!') | 725 call balloon_show('hi!') |
726 endif | 726 endif |
727 endfunc | 727 endfunc |
728 | |
729 func Test_setbufvar_options() | |
730 " This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the | |
731 " window layout. | |
732 call assert_equal(1, winnr('$')) | |
733 split dummy_preview | |
734 resize 2 | |
735 set winfixheight winfixwidth | |
736 let prev_id = win_getid() | |
737 | |
738 wincmd j | |
739 let wh = winheight('.') | |
740 let dummy_buf = bufnr('dummy_buf1', v:true) | |
741 call setbufvar(dummy_buf, '&buftype', 'nofile') | |
742 execute 'belowright vertical split #' . dummy_buf | |
743 call assert_equal(wh, winheight('.')) | |
744 let dum1_id = win_getid() | |
745 | |
746 wincmd h | |
747 let wh = winheight('.') | |
748 let dummy_buf = bufnr('dummy_buf2', v:true) | |
749 call setbufvar(dummy_buf, '&buftype', 'nofile') | |
750 execute 'belowright vertical split #' . dummy_buf | |
751 call assert_equal(wh, winheight('.')) | |
752 | |
753 bwipe! | |
754 call win_gotoid(prev_id) | |
755 bwipe! | |
756 call win_gotoid(dum1_id) | |
757 bwipe! | |
758 endfunc |