summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSalvador Zalapa2013-01-25 15:32:03 (EST)
committerNick Sandonato2013-01-29 14:33:54 (EST)
commitb8d5142d3bd1fd6616d4ebb419507ea10442fb97 (patch)
tree12e6e52ec70ca96475a172b378fd483285e34687
parent1fe88f77f17cd924c7bb21efe19bbbc3cbd5e6ef (diff)
downloadwebtools.sourceediting-b8d5142d3bd1fd6616d4ebb419507ea10442fb97.zip
webtools.sourceediting-b8d5142d3bd1fd6616d4ebb419507ea10442fb97.tar.gz
webtools.sourceediting-b8d5142d3bd1fd6616d4ebb419507ea10442fb97.tar.bz2
[367579] [formatting] Formatting successive comments inserts spacesv201301291945
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java5
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java8
2 files changed, 9 insertions, 4 deletions
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
index 02f34fa..2590d33 100644
--- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/AbstractCSSSourceFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -251,7 +251,8 @@ public abstract class AbstractCSSSourceFormatter implements CSSSourceGenerator {
return;
}
}
- source.append(" ");//$NON-NLS-1$
+ if (!(source.length() > 0 && source.toString().charAt(source.length()-1) == ' '))
+ source.append(" ");//$NON-NLS-1$
}
/**
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java
index 5e5d510..250872a 100644
--- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/formatter/StyleDeclItemFormatter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -223,7 +223,11 @@ public class StyleDeclItemFormatter extends DefaultCSSSourceFormatter {
CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(structuredDocument, new FormatRegion(start, end - start), stgy);
for (int i = 0; i < regions.length; i++) {
appendSpaceBefore(node, regions[i], source);
- source.append(decoratedIdentRegion(regions[i], stgy));
+ String decorateIndetRegion=decoratedIdentRegion(regions[i], stgy);
+ if (decorateIndetRegion.trim().length()== 0)
+ decorateIndetRegion = " "; //$NON-NLS-1$
+ if (!source.toString().endsWith(decorateIndetRegion))
+ source.append(decorateIndetRegion);
}
} else { // generate source
// append "!important"