1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

For whitesmiths, make start of line to be indented with block

This commit is contained in:
David Dubrow 2010-04-29 16:25:12 +00:00
parent 2ec0660653
commit de22c3b311
2 changed files with 11 additions and 1 deletions

View file

@ -515,6 +515,16 @@ public class CAutoIndentTest extends AbstractAutoEditTest {
assertEquals("}", tester.getLine(1)); //$NON-NLS-1$
}
public void testSkipToStatementStartWhitesmiths_Bug311018() throws Exception {
DefaultCodeFormatterOptions whitesmiths= DefaultCodeFormatterOptions.getWhitesmithsSettings();
CCorePlugin.setOptions(new HashMap<String, String>(whitesmiths.getMap()));
AutoEditTester tester = createAutoEditTester();
tester.type("if (i > 0)\n"); //$NON-NLS-1$
tester.type("{\n"); //$NON-NLS-1$
// start is indented to the brace
assertEquals("if (i > 0)\n {\n \n }", tester.fDoc.get());
}
private void assertNoError() {
if (!fStatusLog.isEmpty()) {
fail(fStatusLog.get(0).toString());

View file

@ -1319,8 +1319,8 @@ public final class CIndenter {
case Symbols.TokenWHILE:
case Symbols.TokenFOR:
case Symbols.TokenTRY:
fIndent += fPrefs.prefIndentBracesForBlocks ? 1 : 0;
return fPosition;
case Symbols.TokenCLASS:
case Symbols.TokenSTRUCT:
case Symbols.TokenUNION: