#ifdef SIGTSTP
// See mch_init() for the conditions under which we ignore SIGTSTP.
- signal(SIGTSTP, ignore_sigtstp ? SIG_IGN : (RETSIGTYPE (*)())sig_tstp);
+ // In the GUI default TSTP processing is OK.
+ // Checking both gui.in_use and gui.starting because gui.in_use is not set
+ // at this point (set after menus are displayed), but gui.starting is set.
+ signal(SIGTSTP, ignore_sigtstp ? SIG_IGN
+# ifdef FEAT_GUI
+ : gui.in_use || gui.starting ? SIG_DFL
+# endif
+ : (RETSIGTYPE (*)())sig_tstp);
#endif
#if defined(SIGCONT)
signal(SIGCONT, sigcont_handler);