summaryrefslogtreecommitdiff
path: root/src/testdir/test8.in
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-07-24 16:02:36 +0200
committerBram Moolenaar <Bram@vim.org>2013-07-24 16:02:36 +0200
commit2b90ed294e3e3ce9d02d237317deffe296abf798 (patch)
treebd01cd5b7d22f732b4c1cfe5646d90203fc86f11 /src/testdir/test8.in
parentad875fb7fff85d313fa35acde1afaec998d347d7 (diff)
downloadvim-git-2b90ed294e3e3ce9d02d237317deffe296abf798.tar.gz
updated for version 7.4a.042v7.4a.042
Problem: Crash when BufUnload autocommands close all buffers. (Andrew Pimlott) Solution: Set curwin->w_buffer to curbuf to avoid NULL.
Diffstat (limited to 'src/testdir/test8.in')
-rw-r--r--src/testdir/test8.in22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testdir/test8.in b/src/testdir/test8.in
index 6fe171546..d9d00d97a 100644
--- a/src/testdir/test8.in
+++ b/src/testdir/test8.in
@@ -1,4 +1,5 @@
Test for BufWritePre autocommand that deletes or unloads the buffer.
+Test for BufUnload autocommand that unloads all other buffers.
STARTTEST
:so small.vim
@@ -16,6 +17,27 @@ $r2:.,/end of/w! Xxx2 " write test file Xxx2
:bwipe test.out " remove test.out from the buffer list
:w " write it, will delete the buffer and give an error msg
:w >>test.out " Append contents of this file
+:au! BufWritePre
+:func CloseAll()
+ let i = 0
+ while i <= bufnr('$')
+ if i != bufnr('%') && bufloaded(i)
+ exe i . "bunload"
+ endif
+ let i += 1
+ endwhile
+endfunc
+:func WriteToOut()
+ edit! test.out
+ $put ='VimLeave done'
+ write
+endfunc
+:set viminfo='100,nviminfo
+:au BufUnload * call CloseAll()
+:au VimLeave * call WriteToOut()
+:e small.vim
+:sp mbyte.vim
+:q
:qa!
ENDTEST