Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java15
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp4
-rw-r--r--core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp2
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java6
7 files changed, 21 insertions, 14 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
index 7bdf331271a..0084ff277b9 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java
@@ -1010,12 +1010,15 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
}
if (node instanceof ICPPASTFunctionDefinition) {
- final ICPPASTConstructorChainInitializer[] constructorChain= ((ICPPASTFunctionDefinition) node).getMemberInitializers();
+ final ICPPASTConstructorChainInitializer[] constructorChain=
+ ((ICPPASTFunctionDefinition) node).getMemberInitializers();
if (constructorChain != null && constructorChain.length > 0) {
if (preferences.insert_new_line_before_colon_in_constructor_initializer_list) {
scribe.printTrailingComment();
scribe.startNewLine();
- scribe.indent();
+ for (int i= 0; i < preferences.continuation_indentation; i++) {
+ scribe.indent();
+ }
}
scribe.printNextToken(Token.tCOLON, !preferences.insert_new_line_before_colon_in_constructor_initializer_list);
if (preferences.insert_new_line_before_colon_in_constructor_initializer_list) {
@@ -1023,12 +1026,16 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} else {
scribe.printTrailingComment();
scribe.startNewLine();
- scribe.indent();
+ for (int i= 0; i < preferences.continuation_indentation; i++) {
+ scribe.indent();
+ }
}
final ListAlignment align= new ListAlignment(preferences.alignment_for_constructor_initializer_list);
align.fTieBreakRule = Alignment.R_OUTERMOST;
formatList(Arrays.asList(constructorChain), align, false, false);
- scribe.unIndent();
+ for (int i= 0; i < preferences.continuation_indentation; i++) {
+ scribe.unIndent();
+ }
}
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java
index 3cf8755f5a5..919f37abbef 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/Scribe.java
@@ -552,7 +552,7 @@ public class Scribe {
fSkippedIndentations++;
return;
}
- indentationLevel+= indentationSize;
+ indentationLevel += indentationSize;
numberOfIndentations++;
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
index 10b657596f0..171b1c8c6c4 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp
@@ -16,7 +16,7 @@ class AClass: public ABaseClass {
void test2() throw ();
};
AClass::AClass(int x) throw (int) :
- ABaseClass(x) {
+ ABaseClass(x) {
for (int i = 0; i < 12; i++) {
}
}
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp
index 6b105eb5244..b393f432023 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp
@@ -15,8 +15,8 @@ private:
public:
// comment
Complex(float re, float im) :
- // comment
- re(re), im(im) {
+ // comment
+ re(re), im(im) {
}
// comment
float GetRe() {
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
index 07d43c21b4d..6560d515aee 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/After.cpp
@@ -4,8 +4,8 @@
#include <math.h>
class Point {
public:
- Point(double xc, double yc) :
- x(xc), y(yc) {
+ Point(double x, double y) :
+ x(x), y(y) {
}
double distance(const Point& other) const;
int compareX(const Point& other) const;
diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp
index 461ecc0a9cc..e7c206204c9 100644
--- a/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp
+++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/preview/Before.cpp
@@ -2,7 +2,7 @@
* Indentation
*/
#include <math.h>
-class Point {public:Point(double xc, double yc) : x(xc), y(yc) {}double distance(const Point& other) const;int compareX(const Point& other) const;double x;double y;};double Point::distance(const Point& other) const {double dx = x - other.x;double dy = y - other.y;return sqrt(dx * dx + dy * dy);}int Point::compareX(const Point& other) const {if (x < other.x) {return -1;} else if (x > other.x) {return 1;} else {return 0;}}namespace FOO {int foo(int bar) const {switch (bar) {case 0:++bar;break;case 1:--bar;default: {bar += bar;break;}}}} // end namespace FOO
+class Point {public:Point(double x, double y) : x(x), y(y) {}double distance(const Point& other) const;int compareX(const Point& other) const;double x;double y;};double Point::distance(const Point& other) const {double dx = x - other.x;double dy = y - other.y;return sqrt(dx * dx + dy * dy);}int Point::compareX(const Point& other) const {if (x < other.x) {return -1;} else if (x > other.x) {return 1;} else {return 0;}}namespace FOO {int foo(int bar) const {switch (bar) {case 0:++bar;break;case 1:--bar;default: {bar += bar;break;}}}} // end namespace FOO
/*
* Line Wrapping
*/
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
index e513177c290..e312c791e32 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java
@@ -1120,7 +1120,7 @@ public class CodeFormatterTest extends BaseUITestCase {
//class Point {
//public:
// Point(int x, int y) :
- // x(x), y(y) {
+ // x(x), y(y) {
// }
//
//private:
@@ -1144,8 +1144,8 @@ public class CodeFormatterTest extends BaseUITestCase {
//class Point {
//public:
// Point(int x, int y)
- // : x(x),
- // y(y) {
+ // : x(x),
+ // y(y) {
// }
//
//private:

Back to the top