diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.cpp b/src/plugins/vcsbase/checkoutprogresswizardpage.cpp index b319e3f97bdebb4be15e349f849f70ccfccbbd85..e188f5391d353c0e0254325c15d263e03e0054f2 100644 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.cpp +++ b/src/plugins/vcsbase/checkoutprogresswizardpage.cpp @@ -54,6 +54,7 @@ CheckoutProgressWizardPage::CheckoutProgressWizardPage(QWidget *parent) : QWizardPage(parent), ui(new Ui::CheckoutProgressWizardPage), m_startedStatus(tr("Checkout started...")), + m_overwriteOutput(false), m_state(Idle) { ui->setupUi(this); @@ -86,6 +87,7 @@ void CheckoutProgressWizardPage::start(Command *command) connect(command, SIGNAL(finished(bool,int,QVariant)), this, SLOT(slotFinished(bool,int,QVariant))); QApplication::setOverrideCursor(Qt::WaitCursor); ui->logPlainTextEdit->clear(); + m_overwriteOutput = false; ui->statusLabel->setText(m_startedStatus); ui->statusLabel->setPalette(QPalette()); m_state = Running; @@ -121,7 +123,20 @@ void CheckoutProgressWizardPage::slotFinished(bool ok, int exitCode, const QVari void CheckoutProgressWizardPage::slotOutput(const QString &text) { - ui->logPlainTextEdit->appendPlainText(text.trimmed()); + int startPos = 0; + int crPos = -1; + const QString ansiEraseToEol = QLatin1String("\x1b[K"); + while ((crPos = text.indexOf(QLatin1Char('\r'), startPos)) >= 0) { + QString part = text.mid(startPos, crPos - startPos); + // Discard ANSI erase-to-eol + if (part.endsWith(ansiEraseToEol)) + part.chop(ansiEraseToEol.length()); + outputText(part); + startPos = crPos + 1; + m_overwriteOutput = true; + } + if (startPos < text.count()) + outputText(text.mid(startPos)); } void CheckoutProgressWizardPage::slotError(const QString &text) @@ -129,6 +144,18 @@ void CheckoutProgressWizardPage::slotError(const QString &text) m_error.append(text); } +void CheckoutProgressWizardPage::outputText(const QString &text) +{ + if (m_overwriteOutput) { + QTextCursor cursor = ui->logPlainTextEdit->textCursor(); + cursor.clearSelection(); + cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor); + ui->logPlainTextEdit->setTextCursor(cursor); + m_overwriteOutput = false; + } + ui->logPlainTextEdit->insertPlainText(text); +} + void CheckoutProgressWizardPage::terminate() { if (m_command) diff --git a/src/plugins/vcsbase/checkoutprogresswizardpage.h b/src/plugins/vcsbase/checkoutprogresswizardpage.h index f59782e979678663e366b0f8b00fad9621964933..bd0bf104a39ee374745c93f5eb68546b5c4d68ee 100644 --- a/src/plugins/vcsbase/checkoutprogresswizardpage.h +++ b/src/plugins/vcsbase/checkoutprogresswizardpage.h @@ -67,11 +67,14 @@ private slots: void slotError(const QString &text); private: + void outputText(const QString &text); + Ui::CheckoutProgressWizardPage *ui; Command *m_command; QString m_startedStatus; QString m_error; + bool m_overwriteOutput; State m_state; }; diff --git a/tests/system/suite_tools/tst_git_clone/test.py b/tests/system/suite_tools/tst_git_clone/test.py index c913e71ee9f4f57c99b2fdf11649db368812871e..d94797639b31140088250069287e51e9bde30263 100644 --- a/tests/system/suite_tools/tst_git_clone/test.py +++ b/tests/system/suite_tools/tst_git_clone/test.py @@ -40,10 +40,10 @@ def verifyCloneLog(targetDir, canceled): else: cloneLog = str(waitForObject(":Git Repository Clone.logPlainTextEdit_QPlainTextEdit").plainText) # test for QTCREATORBUG-10112 - test.xcompare(cloneLog.count("remote: Counting objects:"), 1) - test.xcompare(cloneLog.count("remote: Finding sources:"), 1) - test.xcompare(cloneLog.count("Receiving objects:"), 1) - test.xcompare(cloneLog.count("Resolving deltas:"), 1) + test.compare(cloneLog.count("remote: Counting objects:"), 1) + test.compare(cloneLog.count("remote: Finding sources:"), 1) + test.compare(cloneLog.count("Receiving objects:"), 1) + test.compare(cloneLog.count("Resolving deltas:"), 1) test.verify(not "Stopping..." in cloneLog, "Searching for 'Stopping...' in clone log") test.verify(("'" + cloneDir + "'..." in cloneLog),