From: Michael Tremer Date: Wed, 21 Apr 2021 15:24:15 +0000 (+0000) Subject: progressbar: Remove bar when finished to not clutter the terminal X-Git-Tag: 0.9.28~1285^2~282 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e956e1717c93dd6cf213b7f44108862aa6f02fb;p=pakfire.git progressbar: Remove bar when finished to not clutter the terminal Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/progressbar.c b/src/libpakfire/progressbar.c index 6e55e6989..bbb8c1bc9 100644 --- a/src/libpakfire/progressbar.c +++ b/src/libpakfire/progressbar.c @@ -458,6 +458,15 @@ static const char* pakfire_progressbar_bar(struct pakfire_progressbar* p, if (width >= sizeof(widget->buffer) || width < 2) return NULL; + // Remove the bar when we are finished so that the terminal is not so cluttered + if (p->status == PAKFIRE_PROGRESSBAR_FINISHED) { + for (unsigned int i = 0; i < width; i++) + widget->buffer[i] = ' '; + widget->buffer[width] = '\0'; + + return widget->buffer; + } + unsigned int fill = 0; if (p->value_max)