diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-09-25 11:41:03 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-09-25 10:03:15 +0000 |
commit | 4b8635052f26360204ca589bc7536d77227a526d (patch) | |
tree | d3acbea235f2c1a97182f24875962e255cfd1ca8 /src | |
parent | 1d6030044689a48502bba7edcc21498d65353212 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/utils/outputformatter.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index d711569e7a..6748d88174 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -288,12 +288,6 @@ void OutputFormatter::doAppendMessage(const QString &text, OutputFormat 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); const QString cleanLine = std::accumulate(formattedText.begin(), formattedText.end(), QString(), [](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); 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); + if (linkified.isEmpty()) + append({}, charFmt); // This might cause insertion of a newline character. + for (OutputLineParser * const p : qAsConst(involvedParsers)) { if (d->postPrintAction) d->postPrintAction(p); |