mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Cosmetics.
This commit is contained in:
parent
0d4ca399d0
commit
ea13804fa6
3 changed files with 34 additions and 42 deletions
|
@ -3313,8 +3313,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
|
|||
// deal with (quite unexpected) comments right before lcurly
|
||||
scribe.printComment();
|
||||
if (DefaultCodeFormatterConstants.NEXT_LINE_ON_WRAP.equals(bracePosition)
|
||||
&& (scribe.line > line || scribe.column >= preferences.page_width))
|
||||
{
|
||||
&& (scribe.line > line || scribe.column >= preferences.page_width)) {
|
||||
scribe.startNewLine();
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -515,7 +515,8 @@ public class Scribe {
|
|||
public void handleLineTooLong() {
|
||||
// search for closest breakable alignment, using tiebreak rules
|
||||
// look for outermost breakable one
|
||||
int relativeDepth= 0, outerMostDepth= -1;
|
||||
int relativeDepth= 0;
|
||||
int outerMostDepth= -1;
|
||||
Alignment targetAlignment= currentAlignment;
|
||||
while (targetAlignment != null) {
|
||||
if (targetAlignment.tieBreakRule == Alignment.R_OUTERMOST && targetAlignment.couldBreak()) {
|
||||
|
@ -1324,7 +1325,7 @@ public class Scribe {
|
|||
print(currentToken.getLength(), considerSpaceIfAny);
|
||||
}
|
||||
|
||||
private void printRule(StringBuilder stringBuffer) {
|
||||
private void printRuler(StringBuilder stringBuffer) {
|
||||
for (int i= 0; i < pageWidth; i++) {
|
||||
if ((i % tabLength) == 0) {
|
||||
stringBuffer.append('+');
|
||||
|
@ -1520,15 +1521,13 @@ public class Scribe {
|
|||
buffer
|
||||
.append(") - (tabSize = " + tabLength + ")")//$NON-NLS-1$//$NON-NLS-2$
|
||||
.append(lineSeparator)
|
||||
.append(
|
||||
"(line = " + line + ") - (column = " + column + ") - (identationLevel = " + indentationLevel + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
.append("(line = " + line + ") - (column = " + column + ") - (identationLevel = " + indentationLevel + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
.append(lineSeparator)
|
||||
.append(
|
||||
"(needSpace = " + needSpace + ") - (lastNumberOfNewLines = " + lastNumberOfNewLines + ") - (checkLineWrapping = " + checkLineWrapping + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
.append("(needSpace = " + needSpace + ") - (lastNumberOfNewLines = " + lastNumberOfNewLines + ") - (checkLineWrapping = " + checkLineWrapping + ")") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
.append(lineSeparator).append(
|
||||
"==================================================================================") //$NON-NLS-1$
|
||||
.append(lineSeparator);
|
||||
printRule(buffer);
|
||||
printRuler(buffer);
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,12 @@ package org.eclipse.cdt.internal.formatter.align;
|
|||
import org.eclipse.cdt.internal.formatter.Location;
|
||||
import org.eclipse.cdt.internal.formatter.Scribe;
|
||||
|
||||
|
||||
/**
|
||||
* Alignment management
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public class Alignment {
|
||||
|
||||
// name of alignment
|
||||
public String name;
|
||||
|
||||
|
@ -134,7 +132,6 @@ public class Alignment {
|
|||
|
||||
// location to align and break on.
|
||||
public Alignment(String name, int mode, int tieBreakRule, Scribe scribe, int fragmentCount, int sourceRestart, int continuationIndent) {
|
||||
|
||||
this.name = name;
|
||||
this.location = new Location(scribe, sourceRestart);
|
||||
this.mode = mode;
|
||||
|
@ -204,7 +201,6 @@ public class Alignment {
|
|||
}
|
||||
// backtrack only once all fragments got checked
|
||||
if (this.needRedoColumnAlignment && this.fragmentIndex == this.fragmentCount-1) { // alignment too small
|
||||
|
||||
// if (CodeFormatterVisitor.DEBUG) {
|
||||
// System.out.println("ALIGNMENT TOO SMALL");
|
||||
// System.out.println(this);
|
||||
|
@ -320,7 +316,6 @@ public class Alignment {
|
|||
}
|
||||
|
||||
public Alignment getAlignment(String targetName) {
|
||||
|
||||
if (targetName.equals(this.name)) return this;
|
||||
if (this.enclosing == null) return null;
|
||||
|
||||
|
@ -357,7 +352,6 @@ public class Alignment {
|
|||
|
||||
// reset fragment indentation/break status
|
||||
public void reset() {
|
||||
|
||||
if (fragmentCount > 0) {
|
||||
this.fragmentIndentations = new int[this.fragmentCount];
|
||||
this.fragmentBreaks = new int[this.fragmentCount];
|
||||
|
|
Loading…
Add table
Reference in a new issue