summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-05-10 16:53:27 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-10 16:53:27 +0100
commit411da64e77ef9d8edd1a5aa80fa5b9a4b159c93d (patch)
tree7843dd7517bea3b58977b700fe2e6cdb646ed76b /src/ex_docmd.c
parent65b34868dac4bdc99e1144e36d5315b569795fc4 (diff)
patch 9.0.1538: :wqall does not trigger ExitPrev9.0.1538
Problem: :wqall does not trigger ExitPre. (Bart Libert) Solution: Move preparations for :qall to a common function. (closes #12374)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index a0a7183366..430ca2ccb4 100644
--- 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
+ * Do preparations for "qall" and "wqall".
+ * Returns FAIL when quitting should be aborted.
*/
- static void
-ex_quit_all(exarg_T *eap)
+ 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;
+ 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);