]> granicus.if.org Git - vim/commitdiff
patch 8.1.0244: no redraw when using a STOP signal on Vim and then CONT v8.1.0244
authorBram Moolenaar <Bram@vim.org>
Tue, 7 Aug 2018 15:38:41 +0000 (17:38 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 7 Aug 2018 15:38:41 +0000 (17:38 +0200)
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)

src/os_unix.c
src/proto/term.pro
src/term.c
src/version.c

index 3649276c49877bf3bd18d76b316ad94c61db9942..94c3dc9a2ee2b6aac8047f29a28f39d336b6f35e 100644 (file)
@@ -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
 
index 7eafdeffa908bd168a60ec1f1e418b9df45385c0..9a9606baf0b105d8b48ae9121dabf0f670cf1074 100644 (file)
@@ -50,6 +50,7 @@ void setmouse(void);
 int mouse_has(int c);
 int mouse_model_popup(void);
 void scroll_start(void);
+void cursor_on_force(void);
 void cursor_on(void);
 void cursor_off(void);
 void term_cursor_mode(int forced);
index 209a03f5c1a8a298b33102dac89c080026f25036..ace467f6df51f21c23f88615e557c29b3b6ea5b2 100644 (file)
@@ -3788,6 +3788,16 @@ scroll_start(void)
 
 static int cursor_is_off = FALSE;
 
+/*
+ * Enable the cursor without checking if it's already enabled.
+ */
+    void
+cursor_on_force(void)
+{
+    out_str(T_VE);
+    cursor_is_off = FALSE;
+}
+
 /*
  * Enable the cursor.
  */
@@ -3795,10 +3805,7 @@ static int cursor_is_off = FALSE;
 cursor_on(void)
 {
     if (cursor_is_off)
-    {
-       out_str(T_VE);
-       cursor_is_off = FALSE;
-    }
+       cursor_on_force();
 }
 
 /*
index 46125c029d9e79dbc6651d7a1b595a25195c1c60..08345408b4a040a3f3b97f8ee1cf363374e57a90 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    244,
 /**/
     243,
 /**/