diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java index a9a4a9c3841..15ca7f6c2fa 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CIndenterTest.java @@ -1082,4 +1082,23 @@ public class CIndenterTest extends BaseUITestCase { public void testIndentationAfterFunctionCallWithQualifier_Bug562125() throws Exception { assertIndenterResult(); } + + //class Test + //{ + //public: + //Test() + //{ + //} + //}; + + //class Test + //{ + //public: + // Test() + // { + // } + //}; + public void testIndentationAfterContructorWithAccessSpecifier_Bug562181() throws Exception { + assertIndenterResult(); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java index 03fb9d8825a..069e46198a9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java @@ -2245,10 +2245,12 @@ public final class CIndenter { case Symbols.TokenSEMICOLON: case Symbols.TokenRBRACE: fPosition = pos; + fToken = Symbols.TokenIDENT; return true; case Symbols.TokenLBRACE: if (fScanner.looksLikeCompositeTypeDefinitionBackward(fPosition, CHeuristicScanner.UNBOUND)) { fPosition = pos; + fToken = Symbols.TokenIDENT; return true; } break; @@ -2268,11 +2270,13 @@ public final class CIndenter { case Symbols.TokenPROTECTED: case Symbols.TokenPRIVATE: fPosition = pos; + fToken = Symbols.TokenIDENT; return true; case Symbols.TokenRPAREN: // constructor initializer if (skipScope()) { pos = fPosition; + int token = fToken; nextToken(); // optional throw if (fToken == Symbols.TokenTHROW) { @@ -2282,6 +2286,7 @@ public final class CIndenter { } } else { fPosition = pos; + fToken = token; } return looksLikeMethodDecl(); }