mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +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);
|
int pos= fScanner.findReferencePosition(29);
|
||||||
Assert.assertEquals(28, pos);
|
Assert.assertEquals(21, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPrevIndentationUnit5() {
|
public void testPrevIndentationUnit5() {
|
||||||
|
@ -331,7 +331,7 @@ public class CHeuristicScannerTest extends TestCase {
|
||||||
"\t\treturn a");
|
"\t\treturn a");
|
||||||
|
|
||||||
String indent= fScanner.computeIndentation(28).toString();
|
String indent= fScanner.computeIndentation(28).toString();
|
||||||
Assert.assertEquals("\t\t", indent);
|
Assert.assertEquals("\t\t\t", indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIndentation3() {
|
public void testIndentation3() {
|
||||||
|
@ -340,7 +340,7 @@ public class CHeuristicScannerTest extends TestCase {
|
||||||
"\t\treturn a;");
|
"\t\treturn a;");
|
||||||
|
|
||||||
String indent= fScanner.computeIndentation(29).toString();
|
String indent= fScanner.computeIndentation(29).toString();
|
||||||
Assert.assertEquals("\t\t", indent);
|
Assert.assertEquals("\t\t\t", indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIndentation4() {
|
public void testIndentation4() {
|
||||||
|
@ -350,7 +350,7 @@ public class CHeuristicScannerTest extends TestCase {
|
||||||
"");
|
"");
|
||||||
|
|
||||||
String indent= fScanner.computeIndentation(29).toString();
|
String indent= fScanner.computeIndentation(29).toString();
|
||||||
Assert.assertEquals("\t\t", indent);
|
Assert.assertEquals("\t\t\t", indent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIndentation5() {
|
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
|
// if not: take the start of the list ( LPAREN, LBRACE, LBRACKET ) and either align or
|
||||||
// indent by list-indent
|
// indent by list-indent
|
||||||
return skipToPreviousListItemOrListStart();
|
return skipToPreviousListItemOrListStart();
|
||||||
|
|
||||||
|
case Symbols.TokenRETURN:
|
||||||
|
fIndent = fPrefs.prefContinuationIndent;
|
||||||
|
return fPosition;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// inside whatever we don't know about: similar to the list case:
|
// 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
|
// 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;
|
fIndent = fPrefs.prefContinuationIndent;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case Symbols.TokenRETURN:
|
||||||
|
fIndent = fPrefs.prefContinuationIndent;
|
||||||
|
return fPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue