]> git.sur5r.net Git - i3/i3status/commitdiff
ipv6: properly handle colors for output_format == xmobar
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 23 Feb 2013 17:04:52 +0000 (18:04 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 23 Feb 2013 17:04:52 +0000 (18:04 +0100)
src/print_ipv6_addr.c

index 8b11e1fbc2dbc479e3b920a1f7efd9f364b2ea9f..fa50ea5791eb4994f3c16ef44dcff99f55c069a7 100644 (file)
@@ -123,11 +123,13 @@ void print_ipv6_info(yajl_gen json_gen, char *buffer, const char *format_up, con
 
         if (addr_string == NULL) {
                 START_COLOR("color_bad");
-                OUTPUT_FULL_TEXT(format_down);
+                outwalk += sprintf(outwalk, "%s", format_down);
                 END_COLOR;
+                OUTPUT_FULL_TEXT(buffer);
                 return;
         }
 
+        START_COLOR("color_good");
         for (walk = format_up; *walk != '\0'; walk++) {
                 if (*walk != '%') {
                         *(outwalk++) = *walk;
@@ -139,7 +141,6 @@ void print_ipv6_info(yajl_gen json_gen, char *buffer, const char *format_up, con
                         walk += strlen("ip");
                 }
         }
-        START_COLOR("color_good");
-        OUTPUT_FULL_TEXT(buffer);
         END_COLOR;
+        OUTPUT_FULL_TEXT(buffer);
 }