From a5937e4e943eaf28b378a318566d6968f2b167be Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Wed, 25 Feb 2015 18:40:53 +0100 Subject: [PATCH] watch: treat [m as [0m 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/watch.c b/watch.c index c6ef3892..40beacad 100644 --- a/watch.c +++ b/watch.c @@ -226,6 +226,9 @@ static void process_ansi(FILE * fp) * escape sequence "[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)); } -- 2.40.0