diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java index 0a200288ec2..60b56c51a4f 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java @@ -1606,6 +1606,7 @@ public class Scribe { case Token.tRBRACE: case Token.tLBRACE: formatBrace = true; + lastLineComment.contiguous = false; } try { printComment(); diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index e148df85078..4d17fe7922f 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -888,19 +888,27 @@ public class CodeFormatterTest extends BaseUITestCase { assertFormatterResult(); } + //namespace ns1 { + //namespace ns2 { //void foo() { // int x; // comment // int y; // comment // // continuation of the previous comment //// int z; <- comments starting from the beginning of line are not indented //} + //}// namespace ns2 + //}// namespace ns1 + //namespace ns1 { + //namespace ns2 { //void foo() { // int x; // comment // int y; // comment // // continuation of the previous comment //// int z; <- comments starting from the beginning of line are not indented //} + //} // namespace ns2 + //} // namespace ns1 public void testLineCommentMinDistanceFromCode() throws Exception { fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); fOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_MIN_DISTANCE_BETWEEN_CODE_AND_LINE_COMMENT, "2");