diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-17 15:18:06 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-18 13:52:17 +0000 |
commit | 9348ac5fece45460f960281bd003a39d2026b28a (patch) | |
tree | 457e1a29057a9e71a4978e0a24b9d78ba5e73491 /src/libs/utils/outputformatter.cpp | |
parent | 80293aac9364227afe996416cbf399ad09346ee0 (diff) |
Utils: Remove the *SameLine OutputFormat enums
Presumably, they were intended for output that shouldn't get an
automatic newline, but if there ever was such a thing as automatic
newlines, it must have evaporated over time. All users of
OutputFormatter provide a newline if they want one.
Change-Id: Ibd219b7305fd503ce075d6f77930d2b538d5e2e8
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/libs/utils/outputformatter.cpp')
-rw-r--r-- | src/libs/utils/outputformatter.cpp | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/src/libs/utils/outputformatter.cpp b/src/libs/utils/outputformatter.cpp index 3ad865f3ee..d4da38564c 100644 --- a/src/libs/utils/outputformatter.cpp +++ b/src/libs/utils/outputformatter.cpp @@ -144,26 +144,12 @@ void OutputFormatter::initFormats() return; Theme *theme = creatorTheme(); - - // NormalMessageFormat d->formats[NormalMessageFormat].setForeground(theme->color(Theme::OutputPanes_NormalMessageTextColor)); - - // ErrorMessageFormat d->formats[ErrorMessageFormat].setForeground(theme->color(Theme::OutputPanes_ErrorMessageTextColor)); - - // LogMessageFormat d->formats[LogMessageFormat].setForeground(theme->color(Theme::OutputPanes_WarningMessageTextColor)); - - // StdOutFormat d->formats[StdOutFormat].setForeground(theme->color(Theme::OutputPanes_StdOutTextColor)); - d->formats[StdOutFormatSameLine] = d->formats[StdOutFormat]; - - // StdErrFormat d->formats[StdErrFormat].setForeground(theme->color(Theme::OutputPanes_StdErrTextColor)); - d->formats[StdErrFormatSameLine] = d->formats[StdErrFormat]; - d->formats[DebugFormat].setForeground(theme->color(Theme::OutputPanes_DebugTextColor)); - setBoldFontEnabled(d->boldFontEnabled); } @@ -203,34 +189,7 @@ void OutputFormatter::appendMessage(const QString &text, OutputFormat format) d->prependCarriageReturn = true; out.chop(1); } - - if (format != StdOutFormatSameLine && format != StdErrFormatSameLine) { - doAppendMessage(doNewlineEnforcement(out), format); - return; - } - - const bool enforceNewline = d->enforceNewline; - d->enforceNewline = false; - if (enforceNewline) { - out.prepend('\n'); - } else { - const int newline = out.indexOf('\n'); - plainTextEdit()->moveCursor(QTextCursor::End); - if (newline != -1) { - doAppendMessage(out.left(newline), format);// doesn't enforce new paragraph like appendPlainText - out = out.mid(newline); - } - } - - if (out.isEmpty()) { - d->enforceNewline = true; - } else { - if (out.endsWith('\n')) { - d->enforceNewline = true; - out.chop(1); - } - doAppendMessage(out, format); - } + doAppendMessage(doNewlineEnforcement(out), format); } QString OutputFormatter::doNewlineEnforcement(const QString &out) |