From f9a7cd90e15f78010e031de8129e275eb6a8081f Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 17 Oct 2008 09:19:49 +0000 Subject: [PATCH] Bug 250969 - Code Formatter removes necessary whitespaces --- .../cdt/internal/formatter/Scribe.java | 1 + .../cdt/ui/tests/text/CodeFormatterTest.java | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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(); + } }