* (because of an error). May need to restore the terminal mode.
*/
void
-not_exiting(void)
+not_exiting(int save_exiting)
{
- exiting = FALSE;
+ exiting = save_exiting;
settmode(TMODE_RAW);
}
netbeansForcedQuit = eap->forceit;
#endif
+ int save_exiting = exiting;
/*
* If there is only one relevant window we will exit.
*/
|| check_more(TRUE, eap->forceit) == FAIL
|| (only_one_window() && check_changed_any(eap->forceit, TRUE)))
{
- not_exiting();
+ not_exiting(save_exiting);
}
else
{
// :h|wincmd w|q - quit
if (only_one_window() && (ONE_WINDOW || eap->addr_count == 0))
getout(0);
- not_exiting();
+ not_exiting(save_exiting);
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
{
if (before_quit_all(eap) == FAIL)
return;
+ int save_exiting = exiting;
exiting = TRUE;
if (eap->forceit || !check_changed_any(FALSE, FALSE))
getout(0);
- not_exiting();
+ not_exiting(save_exiting);
}
/*
return;
}
+ int save_exiting = exiting;
/*
* we plan to exit if there is only one relevant window
*/
|| check_more(TRUE, eap->forceit) == FAIL
|| (only_one_window() && check_changed_any(eap->forceit, FALSE)))
{
- not_exiting();
+ not_exiting(save_exiting);
}
else
{
if (only_one_window()) // quit last window, exit Vim
getout(0);
- not_exiting();
+ not_exiting(save_exiting);
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
char_u *check_nextcmd(char_u *p);
void set_nextcmd(exarg_T *eap, char_u *arg);
char_u *get_command_name(expand_T *xp, int idx);
-void not_exiting(void);
+void not_exiting(int save_exiting);
int before_quit_autocmds(win_T *wp, int quit_all, int forceit);
void ex_quit(exarg_T *eap);
int before_quit_all(exarg_T *eap);
call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
endif
call delete('Xtestout')
+
+ " Test using :quit in BufWritePost during :wqall
+ let after =<< trim [CODE]
+ botright new Xwritebuf
+ call setline(1, 'SHOULD BE WRITTEN')
+ autocmd BufWritePost Xwritebuf 1quit
+ wqall
+ call setline(1, 'NOT REACHED') | write | qall
+ [CODE]
+
+ if RunVim([], after, '')
+ call assert_equal(['SHOULD BE WRITTEN'], readfile('Xwritebuf'))
+ endif
+ call delete('Xwritebuf')
endfunc
" Test for getting the Vim exit code from v:exiting