08-11-2013 06:08 AM
How do I have to set my bracket style / auto indent options to not have the following formatting affected, i.e. selecting the text and applying 'Format Selection' should not change anything (because this is the way I would like to have it formatted):
Right now, what is happening it the following:
I think that this indent behaviour is not consistent; for example, it does reformat the second line of MemoryAllocateDynamicMemoryStringArray, while it keeps the second line of MemoryCopyString unchanged...
Here are my settings:
Thanks!
Solved! Go to Solution.
08-12-2013 05:45 AM
Hi Wolfgang
Looks like a interesting behavior. I could see the same in my CVI environment. The reason are the string length of the code. If you make it shorter, you get the behavior
like in Memory Copy String. If your function name + space + ( are greater than 40 characters you get the appearance like in your long MemoryAllocated.... Function.
Is it smaller than 40 characters you get the appearance like in the MemoryCopy function.
I searched but I didn't found a way to change this. Sorry
Best regards
Bernhard
08-12-2013 06:33 AM
Thank you, Bernhard, for your investigations and the interesting result.
I am wondering if there is a significant reason to keep the 40 character limit - or if there is hope that this limit might be increased to say 80 characters in the future?
08-14-2013 07:38 AM
Yes, there are plans to allow you more control over this. Can't promise exactly when, though 🙂
08-14-2013 07:48 AM
Thank you Luis, this sounds promising.
But you know that I am going to remind you
08-14-2013 07:55 AM
Oh, yes. I know it well
08-21-2013 03:58 AM
I don't know if I should call it unexpected behavior or missing feature
autoindent treats C comments differently:
while it processes // as comment (as expected) it does not so for /* */ (unexpected)
08-22-2013 07:19 AM
Hi Wolfgang,
Can you give me an example of how // and /* */ are being treated differently?
Luis
08-22-2013 07:39 AM
With pleasure...
some source code with both types of comments:
and after formatting the selection:
the // line is not moved, which is according to my Formatting Options, but the /* */ lines are...
08-23-2013 07:30 AM
Okay, I see.
I understand that you'd like them to be consistent, but I'm not sure if your preference is that both styles of comments be moved, or that neither style be moved.
By default, the /* */ comments are moved to the same indentation level as the next statement, whereas the // comments are not moved at all, as you've seen. However, you can change the policy for the // comments by enabling the Indent Comment option in the Formatting Options dialog. If you do that, then both styles of comments will behave consistently: they will both be indented to the level of the next statement.
Unfortunately, if your preference is that neither style of comment be moved, then that option is not available.
Luis