View | Details | Raw Unified | Return to bug 332818
Collapse All | Expand All

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (+3 lines)
Lines 1004-1009 Link Here
1004
				for (int i = 0; i < linesNumber; i++) {
1004
				for (int i = 0; i < linesNumber; i++) {
1005
					printIndentationIfNecessary(this.tempBuffer);
1005
					printIndentationIfNecessary(this.tempBuffer);
1006
					this.tempBuffer.append(this.lineSeparator);
1006
					this.tempBuffer.append(this.lineSeparator);
1007
					this.column = 1;
1007
				}
1008
				}
1008
				emptyLines = this.tempBuffer.toString();
1009
				emptyLines = this.tempBuffer.toString();
1009
			} else {
1010
			} else {
Lines 1020-1025 Link Here
1020
				for (int i = 0; i < linesNumber; i++) {
1021
				for (int i = 0; i < linesNumber; i++) {
1021
					printIndentationIfNecessary(this.tempBuffer);
1022
					printIndentationIfNecessary(this.tempBuffer);
1022
					this.tempBuffer.append(this.lineSeparator);
1023
					this.tempBuffer.append(this.lineSeparator);
1024
					this.column = 1;
1023
				}
1025
				}
1024
				emptyLines = this.tempBuffer.toString();
1026
				emptyLines = this.tempBuffer.toString();
1025
			} else {
1027
			} else {
Lines 1041-1046 Link Here
1041
				for (int i = 0; i < realNewLineNumber; i++) {
1043
				for (int i = 0; i < realNewLineNumber; i++) {
1042
					printIndentationIfNecessary(this.tempBuffer);
1044
					printIndentationIfNecessary(this.tempBuffer);
1043
					this.tempBuffer.append(this.lineSeparator);
1045
					this.tempBuffer.append(this.lineSeparator);
1046
					this.column = 1;
1044
				}
1047
				}
1045
				emptyLines = this.tempBuffer.toString();
1048
				emptyLines = this.tempBuffer.toString();
1046
			} else {
1049
			} else {
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java (+53 lines)
Lines 7630-7635 Link Here
7630
}
7630
}
7631
7631
7632
/**
7632
/**
7633
 * @bug 332818: [formatter] Java formatter, Blank Lines tab, only 1st line indented when multiple lines is set
7634
 * @test Ensure that the indentation is set on all blank lines
7635
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332818"
7636
 */
7637
public void testBug332818() throws Exception {
7638
	this.formatterPrefs.indent_empty_lines = true;
7639
	this.formatterPrefs.number_of_empty_lines_to_preserve = 99;
7640
	String source =
7641
		"public class Test {\n" + 
7642
		"\n" + 
7643
		" \n" + 
7644
		"  \n" + 
7645
		"   \n" + 
7646
		"    \n" + 
7647
		"	\n" + 
7648
		"    private String f1;\n" + 
7649
		"    \n" + 
7650
		"   \n" + 
7651
		"  \n" + 
7652
		" \n" + 
7653
		"\n" + 
7654
		"	\n" + 
7655
		"	private String f2;\n" + 
7656
		"	\n" + 
7657
		"		\n" + 
7658
		"			\n" + 
7659
		"	\n" + 
7660
		"}\n";
7661
	formatSource(source,
7662
		"public class Test {\n" + 
7663
		"	\n" + 
7664
		"	\n" + 
7665
		"	\n" + 
7666
		"	\n" + 
7667
		"	\n" + 
7668
		"	\n" + 
7669
		"	private String f1;\n" + 
7670
		"	\n" + 
7671
		"	\n" + 
7672
		"	\n" + 
7673
		"	\n" + 
7674
		"	\n" + 
7675
		"	\n" + 
7676
		"	private String f2;\n" + 
7677
		"	\n" + 
7678
		"	\n" + 
7679
		"	\n" + 
7680
		"	\n" + 
7681
		"}\n"
7682
	);
7683
}
7684
7685
/**
7633
 * @bug 332877: [formatter] line comment wrongly put on a new line
7686
 * @bug 332877: [formatter] line comment wrongly put on a new line
7634
 * @test Ensure that the comment on last enum constant is not wrongly put on a new line
7687
 * @test Ensure that the comment on last enum constant is not wrongly put on a new line
7635
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332877"
7688
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=332877"

Return to bug 332818