From 34cf96d645ebdd25b7d2ecf6c22eed031d234ccc Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 17 Mar 2020 16:19:55 +0100 Subject: OutputFormatter: Simplify newline handling There does not seem to be a reason to remove trailing newlines and re- insert them on the next call. Presumably, this is related to historical auto-newline magic. Change-Id: If4dc8acf022d3895b41b887af25d63cca36bf8a4 Reviewed-by: hjk --- src/libs/utils/outputformatter.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/libs/utils/outputformatter.cpp') diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index d4da38564c..f60f45c841 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -43,7 +43,6 @@ public: QTextCursor cursor; AnsiEscapeCodeHandler escapeCodeHandler; bool boldFontEnabled = true; - bool enforceNewline = false; bool prependCarriageReturn = false; }; @@ -160,7 +159,6 @@ void OutputFormatter::handleLink(const QString &href) void OutputFormatter::clear() { - d->enforceNewline = false; d->prependCarriageReturn = false; } @@ -189,23 +187,7 @@ void OutputFormatter::appendMessage(const QString &text, OutputFormat format) d->prependCarriageReturn = true; out.chop(1); } - doAppendMessage(doNewlineEnforcement(out), format); -} - -QString OutputFormatter::doNewlineEnforcement(const QString &out) -{ - QString s = out; - if (d->enforceNewline) { - s.prepend('\n'); - d->enforceNewline = false; - } - - if (s.endsWith('\n')) { - d->enforceNewline = true; // make appendOutputInline put in a newline next time - s.chop(1); - } - - return s; + doAppendMessage(out, format); } } // namespace Utils -- cgit v1.2.3