mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Indentation inside a multi-line return statement. Bug 314397.
This commit is contained in:
parent
a6685ef272
commit
037bcc12e9
2 changed files with 13 additions and 4 deletions
|
@ -117,7 +117,7 @@ public class CHeuristicScannerTest extends TestCase {
|
|||
"");
|
||||
|
||||
int pos= fScanner.findReferencePosition(29);
|
||||
Assert.assertEquals(28, pos);
|
||||
Assert.assertEquals(21, pos);
|
||||
}
|
||||
|
||||
public void testPrevIndentationUnit5() {
|
||||
|
@ -331,7 +331,7 @@ public class CHeuristicScannerTest extends TestCase {
|
|||
"\t\treturn a");
|
||||
|
||||
String indent= fScanner.computeIndentation(28).toString();
|
||||
Assert.assertEquals("\t\t", indent);
|
||||
Assert.assertEquals("\t\t\t", indent);
|
||||
}
|
||||
|
||||
public void testIndentation3() {
|
||||
|
@ -340,7 +340,7 @@ public class CHeuristicScannerTest extends TestCase {
|
|||
"\t\treturn a;");
|
||||
|
||||
String indent= fScanner.computeIndentation(29).toString();
|
||||
Assert.assertEquals("\t\t", indent);
|
||||
Assert.assertEquals("\t\t\t", indent);
|
||||
}
|
||||
|
||||
public void testIndentation4() {
|
||||
|
@ -350,7 +350,7 @@ public class CHeuristicScannerTest extends TestCase {
|
|||
"");
|
||||
|
||||
String indent= fScanner.computeIndentation(29).toString();
|
||||
Assert.assertEquals("\t\t", indent);
|
||||
Assert.assertEquals("\t\t\t", indent);
|
||||
}
|
||||
|
||||
public void testIndentation5() {
|
||||
|
|
|
@ -1091,6 +1091,11 @@ public final class CIndenter {
|
|||
// if not: take the start of the list ( LPAREN, LBRACE, LBRACKET ) and either align or
|
||||
// indent by list-indent
|
||||
return skipToPreviousListItemOrListStart();
|
||||
|
||||
case Symbols.TokenRETURN:
|
||||
fIndent = fPrefs.prefContinuationIndent;
|
||||
return fPosition;
|
||||
|
||||
default:
|
||||
// inside whatever we don't know about: similar to the list case:
|
||||
// if we are inside a continued expression, then either align with a previous line that
|
||||
|
@ -1674,6 +1679,10 @@ public final class CIndenter {
|
|||
fIndent = fPrefs.prefContinuationIndent;
|
||||
}
|
||||
return 0;
|
||||
|
||||
case Symbols.TokenRETURN:
|
||||
fIndent = fPrefs.prefContinuationIndent;
|
||||
return fPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue