To: vim_dev@googlegroups.com Subject: Patch 8.2.0737 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0737 Problem: When shell doesn't support CTRL-Z Vim still handles it. Solution: Ignore the STOP signal if it was ignored on startup. (Kurtis Rader, closes #5990, closes #6058) Files: src/os_unix.c *** ../vim-8.2.0736/src/os_unix.c 2020-05-10 14:13:58.859609394 +0200 --- src/os_unix.c 2020-05-11 20:49:12.664028905 +0200 *************** *** 129,134 **** --- 129,136 ---- Display *x11_display = NULL; #endif + static int ignore_sigtstp = FALSE; + #ifdef FEAT_TITLE static int get_x11_title(int); *************** *** 1237,1242 **** --- 1239,1247 ---- void mch_suspend(void) { + if (ignore_sigtstp) + return; + // BeOS does have SIGTSTP, but it doesn't work. #if defined(SIGTSTP) && !defined(__BEOS__) in_mch_suspend = TRUE; *************** *** 1286,1291 **** --- 1291,1304 ---- Rows = 24; out_flush(); + + #ifdef SIGTSTP + // Check whether we were invoked with SIGTSTP set to be ignored. If it is + // that indicates the shell (or program) that launched us does not support + // tty job control and thus we should ignore that signal. If invoked as a + // restricted editor (e.g., as "rvim") SIGTSTP is always ignored. + ignore_sigtstp = restricted || SIG_IGN == signal(SIGTSTP, SIG_ERR); + #endif set_signals(); #ifdef MACOS_CONVERT *************** *** 1306,1322 **** signal(SIGWINCH, (RETSIGTYPE (*)())sig_winch); #endif - /* - * We want the STOP signal to work, to make mch_suspend() work. - * For "rvim" the STOP signal is ignored. - */ #ifdef SIGTSTP ! signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); #endif #if defined(SIGCONT) signal(SIGCONT, sigcont_handler); #endif - /* * We want to ignore breaking of PIPEs. */ --- 1319,1331 ---- signal(SIGWINCH, (RETSIGTYPE (*)())sig_winch); #endif #ifdef SIGTSTP ! // See mch_init() for the conditions under which we ignore SIGTSTP. ! signal(SIGTSTP, ignore_sigtstp ? SIG_IGN : SIG_DFL); #endif #if defined(SIGCONT) signal(SIGCONT, sigcont_handler); #endif /* * We want to ignore breaking of PIPEs. */ *************** *** 1386,1391 **** --- 1395,1401 ---- int i; for (i = 0; signal_info[i].sig != -1; i++) + { if (signal_info[i].deadly) { #if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION) *************** *** 1420,1426 **** --- 1430,1446 ---- #endif } else if (func_other != SIG_ERR) + { + // Deal with non-deadly signals. + #ifdef SIGTSTP + signal(signal_info[i].sig, + signal_info[i].sig == SIGTSTP && ignore_sigtstp + ? SIG_IGN : func_other); + #else signal(signal_info[i].sig, func_other); + #endif + } + } } #ifdef HAVE_SIGPROCMASK *** ../vim-8.2.0736/src/version.c 2020-05-11 19:46:31.206926174 +0200 --- src/version.c 2020-05-11 20:51:16.959593176 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 737, /**/ -- From "know your smileys": =):-) Uncle Sam /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///