forked from qt-creator/qt-creator
C++ indenter: Fix for extending if conditions.
Task-number: QTCREATORBUG-1825
This commit is contained in:
@@ -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) {
|
||||
|
@@ -266,7 +266,7 @@ void tst_CodeFormatter::ifStatementLongCondition()
|
||||
<< Line(" || (a + b > 4")
|
||||
<< Line(" && foo(bar)")
|
||||
<< Line(" )")
|
||||
<< Line(" ) {")
|
||||
<< Line(" ) {")
|
||||
<< Line(" foo;")
|
||||
<< Line(" }")
|
||||
<< Line("}");
|
||||
|
Reference in New Issue
Block a user