aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/outputformatter.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-03-23 23:02:01 +0200
committerOrgad Shaneh <orgads@gmail.com>2019-04-01 15:31:44 +0000
commitf1665c02aa3dece978278e3a64b60740f378d6b3 (patch)
treec302b185a39a94294b0542b04ae356d68415da1c /src/libs/utils/outputformatter.cpp
parent346b5aa4ad16da62b99b4cc16b7dcf7a257f9779 (diff)
OutputFormatter: Fix behavior of text with different format after \r
For example, git rebase for outdated Git versions has: stdout: Rebasing (1/2)\r stdout: Rebasing (2/2)\r stderr: Successfully rebased and updated refs/heads/master.\n The stderr is supposed to overwrite the Rebasing line. Without redirections, this is what you get on the terminal. Conform to that by deleting a line that ends with \r even if the next output has different format. The only exception is when the following *starts with* \n. On this case, it will behave as \r\n, meaning it will *not* overwrite the previous line, and will continue on the next line. This amends commit 79cfb784be49633fbdafd5fe5b4a3011c5c064ae. Fixes: QTCREATORBUG-22179 Change-Id: I4208008095f3e186aa9b4cee99fa5cd807ffdbcb Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/utils/outputformatter.cpp')
-rw-r--r--src/libs/utils/outputformatter.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp
index d978e757c7..ec85a748a6 100644
--- a/src/libs/utils/outputformatter.cpp
+++ b/src/libs/utils/outputformatter.cpp
@@ -41,7 +41,6 @@ public:
QTextCharFormat formats[NumberOfFormats];
QTextCursor cursor;
AnsiEscapeCodeHandler escapeCodeHandler;
- OutputFormat lastFormat = NumberOfFormats;
bool boldFontEnabled = true;
};
@@ -72,9 +71,8 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
void OutputFormatter::appendMessage(const QString &text, OutputFormat format)
{
- if (!d->cursor.atEnd() && format != d->lastFormat)
+ if (!d->cursor.atEnd() && text.startsWith('\n'))
d->cursor.movePosition(QTextCursor::End);
- d->lastFormat = format;
appendMessage(text, d->formats[format]);
}