diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-07 17:38:41 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-07 17:38:41 +0200 |
commit | 917e32bda5a93941fbbccab09ae3960114b67188 (patch) | |
tree | cb6ca0ec9d5f36da3a40d4efafd080d9830b7d47 /src/os_unix.c | |
parent | 5db7eec42337f0eecdc332f582eecf37278044e8 (diff) | |
download | vim-git-917e32bda5a93941fbbccab09ae3960114b67188.tar.gz |
patch 8.1.0244: no redraw when using a STOP signal on Vim and then CONTv8.1.0244
Problem: No redraw when using a STOP signal on Vim and then a CONT signal.
Solution: Catch the CONT signal and force a redraw. (closes #3285)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 68 |
1 files changed, 55 insertions, 13 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 3649276c4..94c3dc9a2 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1227,7 +1227,23 @@ deathtrap SIGDEFARG(sigarg) SIGRETURN; } -#if defined(_REENTRANT) && defined(SIGCONT) + static void +after_sigcont(void) +{ +# ifdef FEAT_TITLE + // Set oldtitle to NULL, so the current title is obtained again. + VIM_CLEAR(oldtitle); +# endif + settmode(TMODE_RAW); + need_check_timestamps = TRUE; + did_check_timestamps = FALSE; +} + +#if defined(SIGCONT) +static RETSIGTYPE sigcont_handler SIGPROTOARG; +static int in_mch_suspend = FALSE; + +# if defined(_REENTRANT) && defined(SIGCONT) /* * On Solaris with multi-threading, suspending might not work immediately. * Catch the SIGCONT signal, which will be used as an indication whether the @@ -1239,7 +1255,7 @@ deathtrap SIGDEFARG(sigarg) * volatile because it is used in signal handler sigcont_handler(). */ static volatile int sigcont_received; -static RETSIGTYPE sigcont_handler SIGPROTOARG; +# endif /* * signal handler for SIGCONT @@ -1247,7 +1263,38 @@ static RETSIGTYPE sigcont_handler SIGPROTOARG; static RETSIGTYPE sigcont_handler SIGDEFARG(sigarg) { - sigcont_received = TRUE; + if (in_mch_suspend) + { +# if defined(_REENTRANT) && defined(SIGCONT) + sigcont_received = TRUE; +# endif + } + else + { + // We didn't suspend ourselves, assume we were stopped by a SIGSTOP + // signal (which can't be intercepted) and get a SIGCONT. Need to get + // back to a sane mode and redraw. + after_sigcont(); + + update_screen(CLEAR); + if (State & CMDLINE) + redrawcmdline(); + else if (State == HITRETURN || State == SETWSIZE || State == ASKMORE + || State == EXTERNCMD || State == CONFIRM || exmode_active) + repeat_message(); + else if (redrawing()) + setcursor(); +#if defined(FEAT_INS_EXPAND) + if (pum_visible()) + { + redraw_later(NOT_VALID); + ins_compl_show_pum(); + } +#endif + cursor_on_force(); + out_flush(); + } + SIGRETURN; } #endif @@ -1330,6 +1377,8 @@ mch_suspend(void) { /* BeOS does have SIGTSTP, but it doesn't work. */ #if defined(SIGTSTP) && !defined(__BEOS__) + in_mch_suspend = TRUE; + out_flush(); /* needed to make cursor visible on some systems */ settmode(TMODE_COOK); out_flush(); /* needed to disable mouse on some systems */ @@ -1361,16 +1410,9 @@ mch_suspend(void) mch_delay(wait_time, FALSE); } # endif + in_mch_suspend = FALSE; -# ifdef FEAT_TITLE - /* - * Set oldtitle to NULL, so the current title is obtained again. - */ - VIM_CLEAR(oldtitle); -# endif - settmode(TMODE_RAW); - need_check_timestamps = TRUE; - did_check_timestamps = FALSE; + after_sigcont(); #else suspend_shell(); #endif @@ -1410,7 +1452,7 @@ set_signals(void) #ifdef SIGTSTP signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL); #endif -#if defined(_REENTRANT) && defined(SIGCONT) +#if defined(SIGCONT) signal(SIGCONT, sigcont_handler); #endif |