C++ indenter: Fix for extending if conditions.

Task-number: QTCREATORBUG-1825
This commit is contained in:
Christian Kamm
2010-07-08 13:07:32 +02:00
parent aaf2912857
commit c8fae11222
2 changed files with 8 additions and 6 deletions

View File

@@ -1194,11 +1194,13 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i
}
break;
}
case T_RPAREN:
if (topState.type == condition_open) {
*indentDepth = previousState.savedIndentDepth;
}
break;
// Disabled for now, see QTCREATORBUG-1825. It makes extending if conditions
// awkward: inserting a newline just before the ) shouldn't align to 'if'.
//case T_RPAREN:
// if (topState.type == condition_open) {
// *indentDepth = previousState.savedIndentDepth;
// }
// break;
case T_DEFAULT:
case T_CASE:
for (int i = 0; state(i).type != topmost_intro; ++i) {

View File

@@ -266,7 +266,7 @@ void tst_CodeFormatter::ifStatementLongCondition()
<< Line(" || (a + b > 4")
<< Line(" && foo(bar)")
<< Line(" )")
<< Line(" ) {")
<< Line(" ) {")
<< Line(" foo;")
<< Line(" }")
<< Line("}");