Hi,
I'm trying to figure out why, when I type something like this:
void foo(int bar, int baz)
it does not get indented like the manual says it should according to indentNextLinePattern?
I've also found that this:
if (foo) printf("blah");
also doesn't get automatically indented.
I'm using Version 1.5.4 (1349) and have done an 'Update All Bundles' from the 'GetBundle' bundle.
The Indentation Rules preference directly from the C bundle look like this:
{ decreaseIndentPattern = '(?x) ^ (.**/)? \s* } ( [^}{"'']* { | \s* while \s* ( .* )? [;\s]* (//.*|/*.**/\s*)? $ | ^ \s* (public|private|protected): \s* $ '; increaseIndentPattern = '^.*{[^}"'']*$|^\s*(public|private| protected):\s*$'; indentNextLinePattern = '^(?!.*[};:]\s*(//|/*.**/\s*$)).*[^\s;:{}] \s*$'; unIndentedLinePattern = '^\s*((/*|*/|//|#|template\b.*?>(?!(.*))| @protocol|@interface|@implementation|@end).*)?$'; }
On 22. Nov 2006, at 20:51, Wesley Griffin wrote:
I'm trying to figure out why, when I type something like this:
void foo(int bar, int baz)
it does not get indented like the manual says it should according to indentNextLinePattern?
I've also found that this:
if (foo) printf("blah");
also doesn't get automatically indented.
When you say automatically indented, you mean while you type? The indentNextLinePattern is not applied while typing, only the other patterns are.
What I have personally done is, recorded a macro which types a semi- colon and then invokes the Indent Line action from the Text menu, and bound this macro to the ;-key.
That way the current line is properly indented, when I “terminate” it.
Since I think the indent patterns for C/C++ are pretty good by now, it might be time to add this macro to the default C bundle.