From f07aa2db6f1945c13f2a74a7a14cc47c48af5a6c Mon Sep 17 00:00:00 2001 From: "Timothy M. Schaeffer" Date: Thu, 30 Oct 2014 21:59:51 -0400 Subject: [PATCH] On input, ignore % w/o a { after. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows eg “Battery 88%” in the input w/o messing up the colors. --- bar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bar.c b/bar.c index 1b3b4cb..d7e4c56 100644 --- a/bar.c +++ b/bar.c @@ -362,7 +362,8 @@ parse (char *text) if (*p == '\0' || *p == '\n') return; - if (*p == '%' && p++ && *p == '{' && (end = strchr(p++, '}'))) { + if (*p == '%' && *(p+1) == '{' && (end = strchr(p+2, '}'))) { + p += 2; while (p < end) { while (isspace(*p)) p++;