]> granicus.if.org Git - procps-ng/commitdiff
watch: treat <ESC>[m as <ESC>[0m
authorJaromir Capik <jcapik@redhat.com>
Wed, 25 Feb 2015 17:40:53 +0000 (18:40 +0100)
committerJaromir Capik <jcapik@redhat.com>
Wed, 25 Feb 2015 17:40:53 +0000 (18:40 +0100)
Known terminals call reset in case of empty ANSI sequence.
We should do the same, even when this is not defined by the
ANSI standard.

watch.c

diff --git a/watch.c b/watch.c
index c6ef38926fe97dc42aadbb974de97a43ab016ecb..40beacad487767d630aeef8ff56dcc3fe5721f8d 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -226,6 +226,9 @@ static void process_ansi(FILE * fp)
         * escape sequence "<ESC>[0;1;31m". There can be 1 or more
         * attributes to apply, but typically there are between 1 and 3.
         */
+
+       if (*endptr == '\0') set_ansi_attribute(0); /* [m treated as [0m */
+
        for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1)
                set_ansi_attribute(strtol(numstart, &endptr, 10));
 }