Patch 8.2.2898

5 views
Skip to first unread message

Bram Moolenaar

unread,
May 29, 2021, 6:24:28 AM5/29/21
to vim...@googlegroups.com

Patch 8.2.2898
Problem: QuitPre and ExitPre not triggered when GUI window is closed.
Solution: Call before_quit_autocmds(). (closes #8242)
Files: src/ex_docmd.c, src/proto/ex_docmd.pro, src/gui.c


*** ../vim-8.2.2897/src/ex_docmd.c 2021-05-26 21:10:07.285101484 +0200
--- src/ex_docmd.c 2021-05-29 12:19:24.221313277 +0200
***************
*** 5498,5504 ****
settmode(TMODE_RAW);
}

! static int
before_quit_autocmds(win_T *wp, int quit_all, int forceit)
{
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer);
--- 5498,5504 ----
settmode(TMODE_RAW);
}

! int
before_quit_autocmds(win_T *wp, int quit_all, int forceit)
{
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer);
***************
*** 5572,5578 ****
#endif

/*
! * If there are more files or windows we won't exit.
*/
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
exiting = TRUE;
--- 5572,5578 ----
#endif

/*
! * If there is only one relevant window we will exit.
*/
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
exiting = TRUE;
*** ../vim-8.2.2897/src/proto/ex_docmd.pro 2021-03-25 22:15:24.404073755 +0100
--- src/proto/ex_docmd.pro 2021-05-29 12:19:28.341300905 +0200
***************
*** 7,19 ****
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 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);
--- 7,19 ----
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);
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,38 ****
--- 33,39 ----
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);
*** ../vim-8.2.2897/src/gui.c 2021-04-11 13:29:13.194824346 +0200
--- src/gui.c 2021-05-29 12:19:36.817275444 +0200
***************
*** 857,865 ****
void
gui_shell_closed(void)
{
! cmdmod_T save_cmdmod;

! save_cmdmod = cmdmod;

// Only exit when there are no changed files
exiting = TRUE;
--- 857,866 ----
void
gui_shell_closed(void)
{
! cmdmod_T save_cmdmod = cmdmod;

! if (before_quit_autocmds(curwin, TRUE, FALSE))
! return;

// Only exit when there are no changed files
exiting = TRUE;
*** ../vim-8.2.2897/src/version.c 2021-05-28 21:06:04.628687341 +0200
--- src/version.c 2021-05-29 12:19:13.317346028 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2898,
/**/

--
There can't be a crisis today, my schedule is already full.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages