ProjectExplorer: Do not add too many newlines

Do not add newlines when output gets flushed.

Task-number: QTCREATORBUG-17403
Change-Id: I0dea3a15611fcde8aa8cbc5fbc6b7f22c9c40dd7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2017-11-23 17:29:20 +01:00
parent 4c8db5e9b7
commit 58fd29e0ed
4 changed files with 6 additions and 6 deletions

View File

@@ -306,7 +306,7 @@ void ApplicationLauncherPrivate::readLocalStandardOutput()
QByteArray data = m_guiProcess.readAllStandardOutput();
QString msg = m_outputCodec->toUnicode(
data.constData(), data.length(), &m_outputCodecState);
emit q->appendMessage(msg, StdOutFormatSameLine);
emit q->appendMessage(msg, StdOutFormatSameLine, false);
}
void ApplicationLauncherPrivate::readLocalStandardError()
@@ -314,7 +314,7 @@ void ApplicationLauncherPrivate::readLocalStandardError()
QByteArray data = m_guiProcess.readAllStandardError();
QString msg = m_outputCodec->toUnicode(
data.constData(), data.length(), &m_errorCodecState);
emit q->appendMessage(msg, StdErrFormatSameLine);
emit q->appendMessage(msg, StdErrFormatSameLine, false);
}
void ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput()

View File

@@ -70,7 +70,7 @@ public:
static QString msgWinCannotRetrieveDebuggingOutput();
signals:
void appendMessage(const QString &message, Utils::OutputFormat format);
void appendMessage(const QString &message, Utils::OutputFormat format, bool appendNewLine = true);
void processStarted();
void processExited(int exitCode, QProcess::ExitStatus);
void error(QProcess::ProcessError error);

View File

@@ -1810,9 +1810,9 @@ void RunWorker::reportFailure(const QString &msg)
* Appends a message in the specified \a format to
* the owning RunControl's \uicontrol{Application Output} pane.
*/
void RunWorker::appendMessage(const QString &msg, OutputFormat format)
void RunWorker::appendMessage(const QString &msg, OutputFormat format, bool appendNewLine)
{
if (msg.endsWith('\n'))
if (!appendNewLine || msg.endsWith('\n'))
d->runControl->appendMessage(msg, format);
else
d->runControl->appendMessage(msg + '\n', format);

View File

@@ -362,7 +362,7 @@ public:
QVariant recordedData(const QString &channel) const;
// Part of read-only interface of RunControl for convenience.
void appendMessage(const QString &msg, Utils::OutputFormat format);
void appendMessage(const QString &msg, Utils::OutputFormat format, bool appendNewLine = true);
IDevice::ConstPtr device() const;
const Runnable &runnable() const;
Core::Id runMode() const;