From 61dcba87c16b9011ff4e5a3e2e9cf03f995959f5 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Wed, 18 Nov 2015 22:48:09 +1100 Subject: [PATCH] watch: interpret esc[m sequence Commit 99fa7f removed watch crashing from having the null ANSI sequence. However it just ignored that sequence instead of fixing it. This change correctly checks buf (not undefined endptr) and sends the reset attribute if found. Closes: #12 --- watch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/watch.c b/watch.c index a2bd4dc4..e97a4139 100644 --- a/watch.c +++ b/watch.c @@ -228,6 +228,9 @@ static void process_ansi(FILE * fp) * attributes to apply, but typically there are between 1 and 3. */ + /* Special case of [m */ + if (buf[0] == '\0') + set_ansi_attribute(0); for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) { set_ansi_attribute(strtol(numstart, &endptr, 10));