From 054e7c21645b6a3183c202df715f39b1f5488f0d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 17 Mar 2020 16:34:41 +0100 Subject: [PATCH] OutputFormatter: Remove extra carriage return handling There are no \r\n sequences in the text anymore at this point. Change-Id: I3fc220e60ba481f8f8928f74500d18c450ec2e72 Reviewed-by: hjk --- src/libs/utils/outputformatter.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index f60f45c841a..a22a7a19dc1 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -97,21 +97,8 @@ QList OutputFormatter::parseAnsi(const QString &text, const QText void OutputFormatter::append(const QString &text, const QTextCharFormat &format) { - int startPos = 0; - int crPos = -1; - while ((crPos = text.indexOf('\r', startPos)) >= 0) { - if (text.size() > crPos + 1 && text.at(crPos + 1) == '\n') { - d->cursor.insertText(text.mid(startPos, crPos - startPos) + '\n', format); - startPos = crPos + 2; - continue; - } - d->cursor.insertText(text.mid(startPos, crPos - startPos), format); - d->cursor.clearSelection(); - d->cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor); - startPos = crPos + 1; - } - if (startPos < text.count()) - d->cursor.insertText(text.mid(startPos), format); + if (!text.isEmpty()) + d->cursor.insertText(text, format); } QTextCursor &OutputFormatter::cursor() const