Mercurial > vim
diff src/ex_docmd.c @ 32413:edef053f7090 v9.0.1538
patch 9.0.1538: :wqall does not trigger ExitPre
Commit: https://github.com/vim/vim/commit/411da64e77ef9d8edd1a5aa80fa5b9a4b159c93d
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 10 16:53:27 2023 +0100
patch 9.0.1538: :wqall does not trigger ExitPre
Problem: :wqall does not trigger ExitPre. (Bart Libert)
Solution: Move preparations for :qall to a common function. (closes https://github.com/vim/vim/issues/12374)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 May 2023 18:00:06 +0200 |
parents | 5e2f81645b10 |
children | 87f59a64efab |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -5957,10 +5957,11 @@ ex_cquit(exarg_T *eap UNUSED) } /* - * ":qall": try to quit all windows - */ - static void -ex_quit_all(exarg_T *eap) + * Do preparations for "qall" and "wqall". + * Returns FAIL when quitting should be aborted. + */ + int +before_quit_all(exarg_T *eap) { if (cmdwin_type != 0) { @@ -5968,19 +5969,30 @@ ex_quit_all(exarg_T *eap) cmdwin_result = K_XF1; // ex_window() takes care of this else cmdwin_result = K_XF2; - return; + return FAIL; } // Don't quit while editing the command line. if (text_locked()) { text_locked_msg(); - return; + return FAIL; } if (before_quit_autocmds(curwin, TRUE, eap->forceit)) + return FAIL; + + return OK; +} + +/* + * ":qall": try to quit all windows + */ + static void +ex_quit_all(exarg_T *eap) +{ + if (before_quit_all(eap) == FAIL) return; - exiting = TRUE; if (eap->forceit || !check_changed_any(FALSE, FALSE)) getout(0);