summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-05-29 12:21:58 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-29 12:21:58 +0200
commit3552e742898cd57adaf9b8ce32a9056271eab8d2 (patch)
tree9467d5130f7a5adcc12717cf9a75d7ee5571e971
parentd0edaf9dc253e619ccc321ceaac321aee11c1ea5 (diff)
downloadvim-git-3552e742898cd57adaf9b8ce32a9056271eab8d2.tar.gz
patch 8.2.2898: QuitPre and ExitPre not triggered when GUI window is closedv8.2.2898
Problem: QuitPre and ExitPre not triggered when GUI window is closed. Solution: Call before_quit_autocmds(). (closes #8242)
-rw-r--r--src/ex_docmd.c4
-rw-r--r--src/gui.c5
-rw-r--r--src/proto/ex_docmd.pro3
-rw-r--r--src/version.c2
4 files changed, 9 insertions, 5 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 8d8ef08df..58dad657c 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5498,7 +5498,7 @@ not_exiting(void)
settmode(TMODE_RAW);
}
- static int
+ int
before_quit_autocmds(win_T *wp, int quit_all, int forceit)
{
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer);
@@ -5572,7 +5572,7 @@ ex_quit(exarg_T *eap)
#endif
/*
- * If there are more files or windows we won't exit.
+ * If there is only one relevant window we will exit.
*/
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
exiting = TRUE;
diff --git a/src/gui.c b/src/gui.c
index c0374c561..2539a4f64 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -857,9 +857,10 @@ gui_exit(int rc)
void
gui_shell_closed(void)
{
- cmdmod_T save_cmdmod;
+ cmdmod_T save_cmdmod = cmdmod;
- save_cmdmod = cmdmod;
+ if (before_quit_autocmds(curwin, TRUE, FALSE))
+ return;
// Only exit when there are no changed files
exiting = TRUE;
diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro
index 848106350..959f209ac 100644
--- a/src/proto/ex_docmd.pro
+++ b/src/proto/ex_docmd.pro
@@ -7,13 +7,13 @@ int getline_equal(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *co
void *getline_cookie(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char_u *getline_peek(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char *ex_errmsg(char *msg, char_u *arg);
+int checkforcmd(char_u **pp, char *cmd, int len);
int parse_command_modifiers(exarg_T *eap, char **errormsg, cmdmod_T *cmod, int skip_only);
int has_cmdmod(cmdmod_T *cmod);
int cmdmod_error(void);
void apply_cmdmod(cmdmod_T *cmod);
void undo_cmdmod(cmdmod_T *cmod);
int parse_cmd_address(exarg_T *eap, char **errormsg, int silent);
-int checkforcmd(char_u **pp, char *cmd, int len);
char_u *skip_option_env_lead(char_u *start);
char_u *find_ex_command(exarg_T *eap, int *full, int (*lookup)(char_u *, size_t, int cmd, cctx_T *), cctx_T *cctx);
int modifier_len(char_u *cmd);
@@ -33,6 +33,7 @@ char_u *find_nextcmd(char_u *p);
char_u *check_nextcmd(char_u *p);
char_u *get_command_name(expand_T *xp, int idx);
void not_exiting(void);
+int before_quit_autocmds(win_T *wp, int quit_all, int forceit);
void ex_quit(exarg_T *eap);
void tabpage_close(int forceit);
void tabpage_close_other(tabpage_T *tp, int forceit);
diff --git a/src/version.c b/src/version.c
index da315bf13..4b1a7aec9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2898,
+/**/
2897,
/**/
2896,