]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libtextstyle: Make the SIGCONT handler work more reliably.
authorBruno Haible <bruno@clisp.org>
Wed, 27 Mar 2019 20:38:14 +0000 (21:38 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 27 Mar 2019 20:38:14 +0000 (21:38 +0100)
* gnulib-local/lib/term-ostream.oo.c (out_attr_change): Modify active_attr
before emitting the escape sequences, not afterwards.
* libtextstyle/NEWS: Mention the fix.

gnulib-local/lib/term-ostream.oo.c
libtextstyle/NEWS

index 3e8700d0683342ded8b92687506c75c5bb1b58fe..4e2d184e68279f476294bfead715493110c5708b 100644 (file)
@@ -1339,6 +1339,11 @@ out_attr_change (term_ostream_t stream, attributes_t new_attr)
   attributes_t old_attr = stream->active_attr;
   bool cleared_attributes;
 
+  /* Keep track of the active attributes.  Do this *before* emitting the
+     escape sequences, otherwise async_set_attributes_from_default will not
+     do its job correctly.  */
+  stream->active_attr = new_attr;
+
   /* For out_char to work.  */
   out_stream = stream;
   out_fd = stream->fd;
@@ -1438,9 +1443,6 @@ out_attr_change (term_ostream_t stream, attributes_t new_attr)
     {
       out_underline_change (stream, new_attr.underline, false);
     }
-
-  /* Keep track of the active attributes.  */
-  stream->active_attr = new_attr;
 }
 
 static void
index dae693e65dc4a0d4181f616d1a3de1f0c854a18a..43e702115ca03d4800051b83df471550591d1546 100644 (file)
@@ -2,6 +2,8 @@ New in 0.8:
 * Fixed a couple of reliability bugs:
   - When a program exits while the terminal was in non-default state, the
     library left the terminal with ECHO off.
+  - The SIGCONT signal handler would fail to restore the proper styling,
+    with a low probability.
   - The SIGTSTP and SIGCONT signal handlers could clobber errno.
 
 New in 0.7: