aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-11 08:09:13 +0800
committerGitHub <noreply@github.com>2023-05-11 08:09:13 +0800
commit9d306ac6b79c13b5f42ea4e22c6f8ccc628f6a6a (patch)
tree2913703cd2da4908e60e7fe59a88957ef274076a /src/nvim/ex_docmd.c
parentac1aee99bc76c0036aa0ccf7b9eda48fcf46ac11 (diff)
downloadrneovim-9d306ac6b79c13b5f42ea4e22c6f8ccc628f6a6a.tar.gz
rneovim-9d306ac6b79c13b5f42ea4e22c6f8ccc628f6a6a.tar.bz2
rneovim-9d306ac6b79c13b5f42ea4e22c6f8ccc628f6a6a.zip
vim-patch:9.0.1538: :wqall does not trigger ExitPre (#23574)
Problem: :wqall does not trigger ExitPre. (Bart Libert) Solution: Move preparations for :qall to a common function. (closes vim/vim#12374) https://github.com/vim/vim/commit/411da64e77ef9d8edd1a5aa80fa5b9a4b159c93d Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index adb17f2cfd..83232d5f17 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -4589,8 +4589,9 @@ static void ex_cquit(exarg_T *eap)
getout(eap->addr_count > 0 ? (int)eap->line2 : EXIT_FAILURE);
}
-/// ":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) {
if (eap->forceit) {
@@ -4598,19 +4599,28 @@ static void ex_quit_all(exarg_T *eap)
} 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);