QmlJS indenter: Fix ternary multiline indent.

Task-number: QTCREATORBUG-6208
Change-Id: I7e5267291bc01226b5339cb4abdbb15856c58477
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-10-14 12:52:42 +02:00
parent 29dff7221d
commit ea24106373
4 changed files with 37 additions and 18 deletions

View File

@@ -139,18 +139,15 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
if (*indentDepth == tokenPosition) {
// expression_or_objectdefinition doesn't want the indent
// expression_or_label already has it
// ternary already adjusts indents nicely
if (parentState.type != expression_or_objectdefinition
&& parentState.type != expression_or_label
&& parentState.type != binding_assignment
&& parentState.type != ternary_op) {
&& parentState.type != binding_assignment) {
*indentDepth += 2*m_indentSize;
}
}
// expression_or_objectdefinition and expression_or_label have already consumed the first token
else if (parentState.type != expression_or_objectdefinition
&& parentState.type != expression_or_label
&& parentState.type != ternary_op) {
&& parentState.type != expression_or_label) {
*indentDepth = tokenPosition;
}
break;