mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +02:00
Indentation of ctor initializer list.
This commit is contained in:
parent
f15afe121e
commit
2fcc072972
2 changed files with 11 additions and 8 deletions
|
@ -307,16 +307,16 @@ public class CIndenterTest extends BaseUITestCase {
|
||||||
//class A {
|
//class A {
|
||||||
//A(int a,
|
//A(int a,
|
||||||
//int b)
|
//int b)
|
||||||
//:f(0)
|
//: f(0),
|
||||||
//{
|
//g(0) {
|
||||||
//}
|
//}
|
||||||
//};
|
//};
|
||||||
|
|
||||||
//class A {
|
//class A {
|
||||||
// A(int a,
|
// A(int a,
|
||||||
// int b)
|
// int b)
|
||||||
// :f(0)
|
// : f(0),
|
||||||
// {
|
// g(0) {
|
||||||
// }
|
// }
|
||||||
//};
|
//};
|
||||||
public void testConstructorBodyWithInitializer_Bug194586() throws Exception {
|
public void testConstructorBodyWithInitializer_Bug194586() throws Exception {
|
||||||
|
|
|
@ -671,7 +671,6 @@ public final class CIndenter {
|
||||||
// remainder
|
// remainder
|
||||||
while (spaces-- > 0)
|
while (spaces-- > 0)
|
||||||
ret.append(' ');
|
ret.append(' ');
|
||||||
|
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1511,7 +1510,7 @@ public final class CIndenter {
|
||||||
while (true) {
|
while (true) {
|
||||||
nextToken();
|
nextToken();
|
||||||
|
|
||||||
// if any line item comes with its own indentation, adapt to it
|
// If any line item comes with its own indentation, adapt to it
|
||||||
if (fLine < startLine) {
|
if (fLine < startLine) {
|
||||||
try {
|
try {
|
||||||
int lineOffset= fDocument.getLineOffset(startLine);
|
int lineOffset= fDocument.getLineOffset(startLine);
|
||||||
|
@ -1522,9 +1521,13 @@ public final class CIndenter {
|
||||||
fIndent = fPrefs.prefContinuationIndent;
|
fIndent = fPrefs.prefContinuationIndent;
|
||||||
} else {
|
} else {
|
||||||
fAlign= fScanner.findNonWhitespaceForwardInAnyPartition(lineOffset, bound);
|
fAlign= fScanner.findNonWhitespaceForwardInAnyPartition(lineOffset, bound);
|
||||||
|
// If the reference line starts with a colon, skip the colon.
|
||||||
|
if (peekToken(fAlign) == Symbols.TokenCOLON) {
|
||||||
|
fAlign= fScanner.findNonWhitespaceForwardInAnyPartition(fAlign + 1, bound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
// ignore and return just the position
|
// Ignore and return just the position
|
||||||
}
|
}
|
||||||
return startPosition;
|
return startPosition;
|
||||||
}
|
}
|
||||||
|
@ -1955,7 +1958,7 @@ public final class CIndenter {
|
||||||
* Returns <code>true</code> if the current tokens look like a method
|
* Returns <code>true</code> if the current tokens look like a method
|
||||||
* declaration header (i.e. only the return type and method name). The
|
* declaration header (i.e. only the return type and method name). The
|
||||||
* heuristic calls <code>nextToken</code> and expects an identifier
|
* heuristic calls <code>nextToken</code> and expects an identifier
|
||||||
* (method name) and an optional retrun type declaration.
|
* (method name) and an optional return type declaration.
|
||||||
*
|
*
|
||||||
* @return <code>true</code> if the current position looks like a method
|
* @return <code>true</code> if the current position looks like a method
|
||||||
* declaration header.
|
* declaration header.
|
||||||
|
|
Loading…
Add table
Reference in a new issue