Fix possible uninit m_pb, print \33[K (clreol) in the end for less glitches in xfce4-terminal and \r for better window resize

pull/126/head
Vitaliy Filippov 2016-10-01 02:04:04 +03:00
parent e3f948496d
commit 08e29070c2
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ struct CurlAgent::Impl
static struct curl_slist* SetHeader( CURL* handle, const Header& hdr );
CurlAgent::CurlAgent() : Agent(),
m_pimpl( new Impl )
m_pimpl( new Impl ), m_pb( 0 )
{
m_pimpl->curl = ::curl_easy_init();
}

View File

@ -66,7 +66,7 @@ void ProgressBar::reportProgress(u64_t total, u64_t processed)
int dotz = round(fraction * totalDots);
int count = 0;
// delete previous output line
printf("\r\33[2K [%3.0f%%] [", fraction * 100);
printf("\r [%3.0f%%] [", fraction * 100);
for (; count < dotz - 1; count++)
putchar('=');
putchar('>');
@ -76,6 +76,7 @@ void ProgressBar::reportProgress(u64_t total, u64_t processed)
printBytes(processed);
putchar('/');
printBytes(total);
printf("\33[K\r");
if (point == 1000)
putchar('\n');
fflush(stdout);