aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-03-17 16:19:55 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2020-03-18 13:52:41 +0000
commit34cf96d645ebdd25b7d2ecf6c22eed031d234ccc (patch)
tree4952205fdf10583c865fd0c4324fbf826e4f2c21 /src/libs/utils
parent9348ac5fece45460f960281bd003a39d2026b28a (diff)
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 <hjk@qt.io>
Diffstat (limited to 'src/libs/utils')
-rw-r--r--src/libs/utils/outputformatter.cpp20
-rw-r--r--src/libs/utils/outputformatter.h2
2 files changed, 1 insertions, 21 deletions
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
diff --git a/src/libs/utils/outputformatter.h b/src/libs/utils/outputformatter.h
index e97eca6ce7..9c9302c4df 100644
--- a/src/libs/utils/outputformatter.h
+++ b/src/libs/utils/outputformatter.h
@@ -72,8 +72,6 @@ protected:
QTextCursor &cursor() const;
private:
- QString doNewlineEnforcement(const QString &out);
-
virtual void doAppendMessage(const QString &text, const QTextCharFormat &format);
Internal::OutputFormatterPrivate *d;
};