### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v retrieving revision 1.222 diff -u -r1.222 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 26 Nov 2010 16:42:56 -0000 1.222 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 22 Dec 2010 17:32:41 -0000 @@ -1004,6 +1004,7 @@ for (int i = 0; i < linesNumber; i++) { printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(this.lineSeparator); + this.column = 1; } emptyLines = this.tempBuffer.toString(); } else { @@ -1020,6 +1021,7 @@ for (int i = 0; i < linesNumber; i++) { printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(this.lineSeparator); + this.column = 1; } emptyLines = this.tempBuffer.toString(); } else { @@ -1041,6 +1043,7 @@ for (int i = 0; i < realNewLineNumber; i++) { printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(this.lineSeparator); + this.column = 1; } emptyLines = this.tempBuffer.toString(); } else { #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java,v retrieving revision 1.40 diff -u -r1.40 FormatterBugsTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 22 Dec 2010 16:34:42 -0000 1.40 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 22 Dec 2010 17:32:44 -0000 @@ -7630,6 +7630,59 @@ } /** + * @bug 332818: [formatter] Java formatter, Blank Lines tab, only 1st line indented when multiple lines is set + * @test Ensure that the indentation is set on all blank lines + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332818" + */ +public void testBug332818() throws Exception { + this.formatterPrefs.indent_empty_lines = true; + this.formatterPrefs.number_of_empty_lines_to_preserve = 99; + String source = + "public class Test {\n" + + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " private String f1;\n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + " \n" + + " private String f2;\n" + + " \n" + + " \n" + + " \n" + + " \n" + + "}\n"; + formatSource(source, + "public class Test {\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " private String f1;\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " private String f2;\n" + + " \n" + + " \n" + + " \n" + + " \n" + + "}\n" + ); +} + +/** * @bug 332877: [formatter] line comment wrongly put on a new line * @test Ensure that the comment on last enum constant is not wrongly put on a new line * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332877"