From f995022af7eda7a254a275e474828f6ae2510ba4 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Tue, 26 Jan 2010 12:56:05 +0100 Subject: [PATCH] Insert the semicolon at the end of the trimmed line only when it is stricly necessary. --- src/libs/qmljs/qmljsindenter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/qmljs/qmljsindenter.cpp b/src/libs/qmljs/qmljsindenter.cpp index 627a59c3997..76b54bd06f9 100644 --- a/src/libs/qmljs/qmljsindenter.cpp +++ b/src/libs/qmljs/qmljsindenter.cpp @@ -265,6 +265,8 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t) needSemicolon = true; break; + case Token::String: + case Token::Number: case Token::Colon: case Token::LeftBracket: case Token::RightBracket: @@ -278,7 +280,6 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t) break; default: - needSemicolon = true; break; } // end of switch @@ -779,8 +780,8 @@ int QmlJSIndenter::indentForContinuationLine() j + 1 < yyLine->length() && yyLine->at(j + 1) != '=') { if (braceDepth == 0 && delimDepth == 0 && j < yyLine->length() - 1 && - !yyLine->endsWith(QLatin1String(",")) && - (yyLine->contains('(') == yyLine->contains(')'))) + !yyLine->endsWith(QLatin1Char(',')) && + (yyLine->contains(QLatin1Char('(')) == yyLine->contains(QLatin1Char(')')))) hook = j; } } -- GitLab