1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Additional fix and test for bug 322776

This commit is contained in:
Anton Leherbauer 2010-11-18 13:58:36 +00:00
parent 8ccaca146c
commit f9b519b6dd
2 changed files with 5 additions and 5 deletions

View file

@ -462,7 +462,7 @@ public class Scribe {
private String getPreserveEmptyLines(int count) { private String getPreserveEmptyLines(int count) {
if (count == 0 && !preserveNewLines) { if (count == 0 && !preserveNewLines) {
// preserve line breaks in wrapping if specified // preserve line breaks in wrapping if specified
if ((!preferences.join_wrapped_lines) && lastNumberOfNewLines == 0) { if (!preferences.join_wrapped_lines && lastNumberOfNewLines == 0) {
// Create new line // Create new line
StringBuilder tempBuffer = new StringBuilder(); StringBuilder tempBuffer = new StringBuilder();
tempBuffer.append(getNewLine()); tempBuffer.append(getNewLine());
@ -770,7 +770,9 @@ public class Scribe {
handleLineTooLong(); handleLineTooLong();
} }
lastNumberOfNewLines= 0; lastNumberOfNewLines= 0;
printIndentationIfNecessary(); if (indentationLevel != 0) {
printIndentationIfNecessary();
}
if (considerSpaceIfAny) { if (considerSpaceIfAny) {
space(); space();
} }
@ -1150,7 +1152,6 @@ public class Scribe {
if (indentationsAsTab < numberOfLeadingIndents) { if (indentationsAsTab < numberOfLeadingIndents) {
buffer.append('\t'); buffer.append('\t');
indentationsAsTab++; indentationsAsTab++;
lastNumberOfNewLines= 0;
int complement= tabLength - ((column - 1) % tabLength); // amount int complement= tabLength - ((column - 1) % tabLength); // amount
// of // of
// space // space
@ -1165,7 +1166,6 @@ public class Scribe {
} else { } else {
while (column <= indentationLevel) { while (column <= indentationLevel) {
buffer.append('\t'); buffer.append('\t');
lastNumberOfNewLines= 0;
int complement= tabLength - ((column - 1) % tabLength); // amount int complement= tabLength - ((column - 1) % tabLength); // amount
// of // of
// space // space

View file

@ -1458,7 +1458,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//#define X() { } //#define X() { }
//void g() { //void g() {
// X(); // X();
// if (1) { // if (1) {
// x(); // x();
// } // }
// z(); // z();