diff options
| author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-03 14:05:46 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-09-04 22:40:48 -0400 |
| commit | 4d6ba4d06a2b502cd2151b23e2940eb5b692be20 (patch) | |
| tree | 2e5fe4f1842b59fe133755c0c66d4b86ebb0225d /src/nvim/testdir/test_writefile.vim | |
| parent | 9fe8e3cb2f357ea38d53b5d83b3ea0ebf98be58a (diff) | |
| download | rneovim-4d6ba4d06a2b502cd2151b23e2940eb5b692be20.tar.gz rneovim-4d6ba4d06a2b502cd2151b23e2940eb5b692be20.tar.bz2 rneovim-4d6ba4d06a2b502cd2151b23e2940eb5b692be20.zip | |
vim-patch:8.0.1190: unusable after opening new window in BufWritePre event
Problem: Vim becomes unusable after opening new window in BufWritePre
event.
Solution: Call not_exiting(). (Martin Tournoij, closes vim/vim#2205)
Also for "2q" when a help window is open. Add a test.
https://github.com/vim/vim/commit/2c33d7bb69c4c2c5b0e39b03cc4b0c04cfdfbb0b
Diffstat (limited to 'src/nvim/testdir/test_writefile.vim')
| -rw-r--r-- | src/nvim/testdir/test_writefile.vim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim index 8b031646b5..f297f8eb2f 100644 --- a/src/nvim/testdir/test_writefile.vim +++ b/src/nvim/testdir/test_writefile.vim @@ -31,3 +31,47 @@ func Test_writefile_fails_gently() call assert_fails('call writefile([], [])', 'E730:') endfunc + +func SetFlag(timer) + let g:flag = 1 +endfunc + +func Test_write_quit_split() + " Prevent exiting by splitting window on file write. + augroup testgroup + autocmd BufWritePre * split + augroup END + e! Xfile + call setline(1, 'nothing') + wq + + if has('timers') + " timer will not run if "exiting" is still set + let g:flag = 0 + call timer_start(1, 'SetFlag') + sleep 50m + call assert_equal(1, g:flag) + unlet g:flag + endif + au! testgroup + bwipe Xfile + call delete('Xfile') +endfunc + +func Test_nowrite_quit_split() + " Prevent exiting by opening a help window. + e! Xfile + help + wincmd w + exe winnr() . 'q' + + if has('timers') + " timer will not run if "exiting" is still set + let g:flag = 0 + call timer_start(1, 'SetFlag') + sleep 50m + call assert_equal(1, g:flag) + unlet g:flag + endif + bwipe Xfile +endfunc |