forked from qt-creator/qt-creator
AnsiEscapeCodeHandler: Modernize
Change-Id: Ib604ebd070ebd5a555cd63580bd881cbf1634305 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
3b2b50f79f
commit
4f8022888b
@@ -51,11 +51,6 @@ namespace Utils {
|
|||||||
\endlist
|
\endlist
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AnsiEscapeCodeHandler::AnsiEscapeCodeHandler() :
|
|
||||||
m_previousFormatClosed(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static QColor ansiColor(uint code)
|
static QColor ansiColor(uint code)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(code < 8, return QColor());
|
QTC_ASSERT(code < 8, return QColor());
|
||||||
@@ -81,10 +76,10 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
|
|||||||
DefaultBackgroundColor = 49
|
DefaultBackgroundColor = 49
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString escape = QLatin1String("\x1b[");
|
const QString escape = "\x1b[";
|
||||||
const QChar semicolon = QLatin1Char(';');
|
const QChar semicolon = ';';
|
||||||
const QChar colorTerminator = QLatin1Char('m');
|
const QChar colorTerminator = 'm';
|
||||||
const QChar eraseToEol = QLatin1Char('K');
|
const QChar eraseToEol = 'K';
|
||||||
|
|
||||||
QList<FormattedText> outputData;
|
QList<FormattedText> outputData;
|
||||||
QTextCharFormat charFormat = m_previousFormatClosed ? input.format : m_previousFormat;
|
QTextCharFormat charFormat = m_previousFormatClosed ? input.format : m_previousFormat;
|
||||||
|
@@ -46,14 +46,13 @@ public:
|
|||||||
class QTCREATOR_UTILS_EXPORT AnsiEscapeCodeHandler
|
class QTCREATOR_UTILS_EXPORT AnsiEscapeCodeHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AnsiEscapeCodeHandler();
|
|
||||||
QList<FormattedText> parseText(const FormattedText &input);
|
QList<FormattedText> parseText(const FormattedText &input);
|
||||||
void endFormatScope();
|
void endFormatScope();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setFormatScope(const QTextCharFormat &charFormat);
|
void setFormatScope(const QTextCharFormat &charFormat);
|
||||||
|
|
||||||
bool m_previousFormatClosed;
|
bool m_previousFormatClosed = true;
|
||||||
QTextCharFormat m_previousFormat;
|
QTextCharFormat m_previousFormat;
|
||||||
QString m_pendingText;
|
QString m_pendingText;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user