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 ca00e95944d..5a65a84c332 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 @@ -1708,6 +1708,7 @@ public class Scribe { fSkippedIndentations++; } if (offset > currentPosition) { + space(); printRaw(currentPosition, offset - currentPosition); scanner.resetTo(offset, scannerEndPosition - 1); } 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 857a635d6bb..8f25dcf3867 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 @@ -852,5 +852,24 @@ public class CodeFormatterTest extends BaseUITestCase { public void testPreserveSpaceBetweenPointerModifierAndIdentifier_Bug243056() throws Exception { assertFormatterResult(); } - + + //#define FUNCTION_NAME myFunc + //#define VARIABLE_NAME myVar + // + //void FUNCTION_NAME( void ); + //void FUNCTION_NAME( void ) + //{ + //int VARIABLE_NAME; + //} + + //#define FUNCTION_NAME myFunc + //#define VARIABLE_NAME myVar + // + //void FUNCTION_NAME(void); + //void FUNCTION_NAME(void) { + // int VARIABLE_NAME; + //} + public void testPreserveNecessarySpace_Bug250969() throws Exception { + assertFormatterResult(); + } }