LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

auto indent

Solved!
Go to solution

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):

 

before.png

 

Right now, what is happening it the following:

 

after.png

 

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:

 

formatting_options.png

 

Thanks!

0 Kudos
Message 1 of 11
(5,694 Views)

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

Message 2 of 11
(5,672 Views)

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? Smiley Wink

0 Kudos
Message 3 of 11
(5,667 Views)
Solution
Accepted by topic author Wolfgang

Yes, there are plans to allow you more control over this. Can't promise exactly when, though 🙂

0 Kudos
Message 4 of 11
(5,632 Views)

Thank you Luis, this sounds promising.  Smiley Happy

 

But you know that I am going to remind you Smiley Wink

0 Kudos
Message 5 of 11
(5,628 Views)

Oh, yes. I know it well Smiley Tongue

0 Kudos
Message 6 of 11
(5,623 Views)

I don't know if I should call it unexpected behavior or missing feature Smiley Wink

 

autoindent treats C comments differently:

 

while it processes // as comment (as expected) it does not so for /*   */ (unexpected)

0 Kudos
Message 7 of 11
(5,568 Views)

Hi Wolfgang,

 

Can you give me an example of how // and /* */ are being treated differently?

 

Luis

0 Kudos
Message 8 of 11
(5,544 Views)

With pleasure...

 

some source code with both types of comments:

 

before.png

 

and after formatting the selection:

 

after.png

 

the // line is not moved, which is according to my Formatting Options, but the /* */ lines are...

0 Kudos
Message 9 of 11
(5,539 Views)

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

0 Kudos
Message 10 of 11
(5,518 Views)