tabpage_T *next_tp;
buf_T *buf;
win_T *wp;
+ int unblock = 0;
// Trigger BufWinLeave for all windows, but only once per buffer.
for (tp = first_tabpage; tp != NULL; tp = next_tp)
// autocmd deleted the buffer
break;
}
+
+ // deathtrap() blocks autocommands, but we do want to trigger
+ // VimLeavePre.
+ if (is_autocmd_blocked())
+ {
+ unblock_autocmds();
+ ++unblock;
+ }
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
+ if (unblock)
+ block_autocmds();
}
#ifdef FEAT_VIMINFO
if cmd =~ 'valgrind'
throw 'Skipped: cannot test signal TERM with valgrind'
endif
+ let lines =<< trim END
+ au VimLeave * call writefile(["VimLeave triggered"], "XautoOut", "a")
+ au VimLeavePre * call writefile(["VimLeavePre triggered"], "XautoOut", "a")
+ END
+ call writefile(lines, 'XsetupAucmd')
- let buf = RunVimInTerminal('Xsig_TERM', {'rows': 6})
+ let buf = RunVimInTerminal('-S XsetupAucmd Xsig_TERM', {'rows': 6})
let pid_vim = term_getjob(buf)->job_info().process
call term_sendkeys(buf, ":call setline(1, 'foo')\n")
silent recover .Xsig_TERM.swp
call assert_equal(['foo'], getline(1, '$'))
+ let result = readfile('XautoOut')
+ call assert_match('VimLeavePre triggered', result[0])
+ call assert_match('VimLeave triggered', result[1])
+
%bwipe!
call delete('.Xsig_TERM.swp')
+ call delete('XsetupAucmd')
+ call delete('XautoOut')
endfunc
" vim: ts=8 sw=2 sts=2 tw=80 fdm=marker