Mercurial > vim
diff src/main.c @ 20429:c88ebfcbab03 v8.2.0769
patch 8.2.0769: VimLeavePre not triggered when Vim is terminated
Commit: https://github.com/vim/vim/commit/129d6bf6b3d120b0a4c69e18b5e8602a84e352bf
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 16 16:08:35 2020 +0200
patch 8.2.0769: VimLeavePre not triggered when Vim is terminated
Problem: VimLeavePre not triggered when Vim is terminated.
Solution: Unblock autocommands.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 16 May 2020 16:15:04 +0200 |
parents | f1956699a8e4 |
children | 70d561931721 |
line wrap: on
line diff
--- a/src/main.c +++ b/src/main.c @@ -1576,6 +1576,7 @@ getout(int exitval) 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) @@ -1617,7 +1618,17 @@ getout(int exitval) // 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