From b6dffdf3fa31028bb7f4097e62411ba679a7545a Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Thu, 12 Nov 2020 09:29:22 -0700 Subject: Fix battery is charging label printing This was previously printing too much whitespace. It was also doing a strlen comparison to determine where to write the label text, but it always resolved to index 0, so is not needed. --- src/config_bat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config_bat.c b/src/config_bat.c index b25f1cc..e55ecec 100644 --- a/src/config_bat.c +++ b/src/config_bat.c @@ -68,13 +68,13 @@ int config_bat_load(struct node* n) { } if(_bat_is_charging(batstatus) == 1) { - sprintf(n->text + strlen(n->text), "%lc", 0x26A1); + sprintf(n->text, "%lc", 0x26A1); } else { - strcat(n->text, " "); + strcpy(n->text, " "); } if(strcmp(n->display, "bar") == 0) { - print_bar(12, (float) level / 100, &n->text[3]); + print_bar(12, (float) level / 100, &n->text[strlen(n->text)]); } else { sprintf(n->text, "%02d%%", (int)(level / 100)); } -- cgit v1.2.3