Utils: Support \r handling in OutputFormatter

Change-Id: Iae7ddc376cff86eef9d6873bdb6a6ed3f5f7022f
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2014-03-18 20:23:08 +02:00
committed by Orgad Shaneh
parent 1c953f0ac0
commit 0960127ece
5 changed files with 39 additions and 30 deletions

View File

@@ -100,12 +100,18 @@ QList<FormattedText> AnsiEscapeCodeHandler::parseText(const FormattedText &input
const QChar semicolon = QLatin1Char(';');
const QChar colorTerminator = QLatin1Char('m');
const QChar eraseToEol = QLatin1Char('K');
// strippedText always starts with "\e["
QString strippedText = input.text.mid(escapePos);
while (!strippedText.isEmpty()) {
while (strippedText.startsWith(escape)) {
strippedText.remove(0, 2);
// \e[K is not supported. Just strip it.
if (strippedText.startsWith(eraseToEol)) {
strippedText.remove(0, 1);
continue;
}
// get the number
QString strNumber;
QStringList numbers;