forked from qt-creator/qt-creator
OutputFormatter: Fix flushing a pending line feed
... for the edge case of a lone carriage return occurring in the output.
Amends b0cad9e9c7.
Also adds missing adaptations to the unit test.
Change-Id: I219b24b8fb41bb0fcea9f677cd79286d03b130c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -429,6 +429,7 @@ void OutputFormatter::append(const QString &text, const QTextCharFormat &format)
|
||||
{
|
||||
if (!plainTextEdit())
|
||||
return;
|
||||
flushTrailingNewline();
|
||||
int startPos = 0;
|
||||
int crPos = -1;
|
||||
while ((crPos = text.indexOf('\r', startPos)) >= 0) {
|
||||
@@ -437,7 +438,6 @@ void OutputFormatter::append(const QString &text, const QTextCharFormat &format)
|
||||
d->cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
|
||||
startPos = crPos + 1;
|
||||
}
|
||||
flushTrailingNewline();
|
||||
if (startPos < text.count())
|
||||
d->cursor.insertText(text.mid(startPos), format);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user