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 <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-03-17 16:34:41 +01:00
parent 34cf96d645
commit 054e7c2164

View File

@@ -97,21 +97,8 @@ QList<FormattedText> 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