Mercurial > vim
comparison src/testdir/test_writefile.vim @ 12624:ae2802b6bf7d v8.0.1190
patch 8.0.1190: unusable after opening new window in BufWritePre event
commit https://github.com/vim/vim/commit/2c33d7bb69c4c2c5b0e39b03cc4b0c04cfdfbb0b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 14 16:06:20 2017 +0200
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 #2205)
Also for "2q" when a help window is open. Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 14 Oct 2017 16:15:04 +0200 |
parents | 16ccaedce025 |
children | ffdf2e4b5d9a |
comparison
equal
deleted
inserted
replaced
12623:7d75889569e2 | 12624:ae2802b6bf7d |
---|---|
47 | 47 |
48 call delete('Xfile') | 48 call delete('Xfile') |
49 bwipe! | 49 bwipe! |
50 set backup& writebackup& | 50 set backup& writebackup& |
51 endfunc | 51 endfunc |
52 | |
53 func SetFlag(timer) | |
54 let g:flag = 1 | |
55 endfunc | |
56 | |
57 func Test_write_quit_split() | |
58 " Prevent exiting by splitting window on file write. | |
59 augroup testgroup | |
60 autocmd BufWritePre * split | |
61 augroup END | |
62 e! Xfile | |
63 call setline(1, 'nothing') | |
64 wq | |
65 | |
66 if has('timers') | |
67 " timer will not run if "exiting" is still set | |
68 let g:flag = 0 | |
69 call timer_start(1, 'SetFlag') | |
70 sleep 50m | |
71 call assert_equal(1, g:flag) | |
72 unlet g:flag | |
73 endif | |
74 au! testgroup | |
75 bwipe Xfile | |
76 call delete('Xfile') | |
77 endfunc | |
78 | |
79 func Test_nowrite_quit_split() | |
80 " Prevent exiting by opening a help window. | |
81 e! Xfile | |
82 help | |
83 wincmd w | |
84 exe winnr() . 'q' | |
85 | |
86 if has('timers') | |
87 " timer will not run if "exiting" is still set | |
88 let g:flag = 0 | |
89 call timer_start(1, 'SetFlag') | |
90 sleep 50m | |
91 call assert_equal(1, g:flag) | |
92 unlet g:flag | |
93 endif | |
94 bwipe Xfile | |
95 endfunc |