mirror of https://github.com/vitalif/grive2
Fix possible uninit m_pb, print \33[K (clreol) in the end for less glitches in xfce4-terminal and \r for better window resize
parent
e3f948496d
commit
08e29070c2
|
@ -71,7 +71,7 @@ struct CurlAgent::Impl
|
||||||
static struct curl_slist* SetHeader( CURL* handle, const Header& hdr );
|
static struct curl_slist* SetHeader( CURL* handle, const Header& hdr );
|
||||||
|
|
||||||
CurlAgent::CurlAgent() : Agent(),
|
CurlAgent::CurlAgent() : Agent(),
|
||||||
m_pimpl( new Impl )
|
m_pimpl( new Impl ), m_pb( 0 )
|
||||||
{
|
{
|
||||||
m_pimpl->curl = ::curl_easy_init();
|
m_pimpl->curl = ::curl_easy_init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ void ProgressBar::reportProgress(u64_t total, u64_t processed)
|
||||||
int dotz = round(fraction * totalDots);
|
int dotz = round(fraction * totalDots);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// delete previous output line
|
// delete previous output line
|
||||||
printf("\r\33[2K [%3.0f%%] [", fraction * 100);
|
printf("\r [%3.0f%%] [", fraction * 100);
|
||||||
for (; count < dotz - 1; count++)
|
for (; count < dotz - 1; count++)
|
||||||
putchar('=');
|
putchar('=');
|
||||||
putchar('>');
|
putchar('>');
|
||||||
|
@ -76,6 +76,7 @@ void ProgressBar::reportProgress(u64_t total, u64_t processed)
|
||||||
printBytes(processed);
|
printBytes(processed);
|
||||||
putchar('/');
|
putchar('/');
|
||||||
printBytes(total);
|
printBytes(total);
|
||||||
|
printf("\33[K\r");
|
||||||
if (point == 1000)
|
if (point == 1000)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
Loading…
Reference in New Issue