[SVN] Broken Indentation

Shiran Pasternak shiranpasternak at gmail.com
Thu Dec 29 19:59:08 UTC 2005


I found the following two conditions that break indentation while  
trying to indent a selection. I'm not sure what is the source of the  
errors. I found this to be true in at least C, Java, Perl, and  
JavaScript modes, so I'm assuming this is global.

1. Cuddled elses:

if (1) {
statement1;
} else {
statement2;
}

Expected indentation:

if (1) {
     statement1;
} else {
     statement2;
}

Actual result:

if (1) {
     statement1;
     } else {
         statement2;
     }

Uncuddled elses are indented correctly, i.e.:

if (1) {
     statement1;
}
else {
     statement2;
}

2. Quotes in comments. If an open brace is followed by a comment on  
the same line (either block comments or double-slash comments) that  
contains either single quotes or double quotes, it breaks the  
indentation of the following block.

if (1) { // Comment contains "quotes"
statement1;
}

Does not indent correctly. However,

if (1) { // Comment has no quotes
	statement1;
}

does indent correctly. If the comment is below the opening brace,  
indentation is normal, with or without quotes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20051229/d2c11784/attachment.html>


More information about the textmate-dev mailing list