1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +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

@ -817,6 +817,8 @@ public class CIndenterTest extends BaseUITestCase {
// { // {
// } // }
public void testIndentationOfConstMethodBody_Bug298282() throws Exception { public void testIndentationOfConstMethodBody_Bug298282() throws Exception {
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION,
DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED);
assertIndenterResult(); assertIndenterResult();
} }

View file

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