1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Fix and test for case where method body brace should be indented once - bug 298282

This commit is contained in:
David Dubrow 2010-04-13 14:26:53 +00:00
parent 868b8f9a8a
commit a60027bd99
2 changed files with 5 additions and 3 deletions

View file

@ -814,9 +814,11 @@ public class CIndenterTest extends BaseUITestCase {
//}
//void t() const
//{
//}
// {
// }
public void testIndentationOfConstMethodBody_Bug298282() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION,
DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
assertIndenterResult();
}

View file

@ -847,7 +847,7 @@ public final class CIndenter {
} else if ((prevToken == Symbols.TokenEQUAL || prevToken == Symbols.TokenRBRACKET) &&
!fPrefs.prefIndentBracesForArrays) {
cancelIndent= true;
} else if (prevToken == Symbols.TokenRPAREN && fPrefs.prefIndentBracesForMethods) {
} else if ((prevToken == Symbols.TokenRPAREN || prevToken == Symbols.TokenCONST) && fPrefs.prefIndentBracesForMethods) {
extraIndent= 1;
} else if (prevToken == Symbols.TokenIDENT && fPrefs.prefIndentBracesForTypes) {
extraIndent= 1;