Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
1.12.1
-
None
-
-
41e1a4bd2b667c7e5c54553e2b189b2beb38ef49 (qbs/qbs/master)
Description
Currently the --show-progress option is not supported on the windows platform. If I'm not wrong the only reason is the different console type on windows? I wrote some code that should work for all console types. I tested this successful on windows with a dos, cygwin and mingw64 shell.
void ConsoleProgressObserver::eraseCurrentPercentageString() { const int charsToErase = m_percentage == 0 ? 2 : m_percentage < 10 ? 3 : 4; // move cursor left std::cout << QString(charsToErase, QChar(QLatin1Char('\b'))).toLocal8Bit().constData(); // erase via spaces std::cout << QString(charsToErase, QChar(QLatin1Char(' '))).toLocal8Bit().constData(); // move cursor left again std::cout << QString(charsToErase, QChar(QLatin1Char('\b'))).toLocal8Bit().constData(); #if 0 // old implementation // (1) Move cursor before the old percentage string. // (2) Erase current line content to the right of the cursor. std::cout << QString::fromLatin1("\x1b[%1D").arg(charsToErase).toLocal8Bit().constData(); std::cout << "\x1b[K"; #endif }