Mercurial > vim
diff src/ex_docmd.c @ 3570:e7ff3251dfa1 v7.3.545
updated for version 7.3.545
Problem: When closing a window or buffer autocommands may close it too,
causing problems for where the autocommand was invoked from.
Solution: Add the w_closing and b_closing flags. When set disallow ":q" and
":close" to prevent recursive closing.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 06 Jun 2012 19:02:45 +0200 |
parents | 09d0bda69df0 |
children | e5b925ae56e3 |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -6459,7 +6459,9 @@ ex_quit(eap) } #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); - if (curbuf_locked()) + /* Refuse to quick when locked or when the buffer in the last window is + * being closed (can only happen in autocommands). */ + if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) return; #endif