Merge pull request #458 from Explorer09/bar-tweaks

BarMeterMode_draw() minor code improvement
This commit is contained in:
Hisham Muhammad 2016-03-25 01:57:10 -03:00
commit 6c2f698a47

View File

@ -287,11 +287,8 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) {
char bar[w + 1];
int blockSizes[10];
for (int i = 0; i < w; i++)
bar[i] = ' ';
const size_t barOffset = w - MIN((int)strlen(buffer), w);
snprintf(bar + barOffset, w - barOffset + 1, "%s", buffer);
snprintf(bar, w + 1, "%*s", w, buffer);
// First draw in the bar[] buffer...
int offset = 0;