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 aee44827c18..a9a4a9c3841 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 @@ -1067,4 +1067,19 @@ public class CIndenterTest extends BaseUITestCase { public void testIndentationAfterArgumentWithQualifier_Bug516393() throws Exception { assertIndenterResult(); // global scope } + + //x = f() + //+ ::f() + //+ A::f() + //+ ::A::f() + //+ B::C::f(); + + //x = f() + // + ::f() + // + A::f() + // + ::A::f() + // + B::C::f(); + public void testIndentationAfterFunctionCallWithQualifier_Bug562125() 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 85ba6a75d32..03fb9d8825a 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 @@ -2219,8 +2219,9 @@ public final class CIndenter { if (fToken == Symbols.TokenTILDE) { return true; } - if (skipQualifiers()) { - return true; + // optional class or namespace qualifiers + while (skipQualifiers()) { + nextToken(); } // optional brackets for array valued return types while (skipBrackets()) { @@ -2238,6 +2239,9 @@ public final class CIndenter { switch (fToken) { case Symbols.TokenIDENT: return true; + case Symbols.TokenEOF: + // EOF can be seen in constructor definition outside the class + // at the beginning of the source file case Symbols.TokenSEMICOLON: case Symbols.TokenRBRACE: fPosition = pos;