forked from qt-creator/qt-creator
OutputFormatter: Run line parsers also for empty lines
Empty lines can be relevant semantically, e.g. to mark the end of a
block of messages.
Amends 5cb74af166
.
Change-Id: I31cb32dcbf6a69f03324e0d2c00f95547c994d85
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -288,12 +288,6 @@ void OutputFormatter::doAppendMessage(const QString &text, OutputFormat format)
|
|||||||
{
|
{
|
||||||
QTextCharFormat charFmt = charFormat(format);
|
QTextCharFormat charFmt = charFormat(format);
|
||||||
|
|
||||||
// This might cause insertion of a newline character.
|
|
||||||
if (text.isEmpty()) {
|
|
||||||
append(text, charFmt);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<FormattedText> formattedText = parseAnsi(text, charFmt);
|
QList<FormattedText> formattedText = parseAnsi(text, charFmt);
|
||||||
const QString cleanLine = std::accumulate(formattedText.begin(), formattedText.end(), QString(),
|
const QString cleanLine = std::accumulate(formattedText.begin(), formattedText.end(), QString(),
|
||||||
[](const FormattedText &t1, const FormattedText &t2) { return t1.text + t2.text; });
|
[](const FormattedText &t1, const FormattedText &t2) { return t1.text + t2.text; });
|
||||||
@@ -315,8 +309,13 @@ void OutputFormatter::doAppendMessage(const QString &text, OutputFormat format)
|
|||||||
append(res.newContent.value(), charFmt);
|
append(res.newContent.value(), charFmt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const FormattedText &output : linkifiedText(formattedText, res.linkSpecs))
|
|
||||||
|
const QList<FormattedText> linkified = linkifiedText(formattedText, res.linkSpecs);
|
||||||
|
for (const FormattedText &output : linkified)
|
||||||
append(output.text, output.format);
|
append(output.text, output.format);
|
||||||
|
if (linkified.isEmpty())
|
||||||
|
append({}, charFmt); // This might cause insertion of a newline character.
|
||||||
|
|
||||||
for (OutputLineParser * const p : qAsConst(involvedParsers)) {
|
for (OutputLineParser * const p : qAsConst(involvedParsers)) {
|
||||||
if (d->postPrintAction)
|
if (d->postPrintAction)
|
||||||
d->postPrintAction(p);
|
d->postPrintAction(p);
|
||||||
|
Reference in New Issue
Block a user