LabWindows/CVI

cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

auto indent

Resolvido!
Ir para a solução

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
Mensagem 1 de 11
6.652Exibições

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

Mensagem 2 de 11
6.630Exibições

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? Piscadela do Smiley

0 Kudos
Mensagem 3 de 11
6.625Exibições
Solução
Aceita por Wolfgang

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

0 Kudos
Mensagem 4 de 11
6.590Exibições

Thank you Luis, this sounds promising.  Smiley feliz

 

But you know that I am going to remind you Piscadela do Smiley

0 Kudos
Mensagem 5 de 11
6.586Exibições

Oh, yes. I know it well Língua do Smiley

0 Kudos
Mensagem 6 de 11
6.581Exibições

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

 

autoindent treats C comments differently:

 

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

0 Kudos
Mensagem 7 de 11
6.526Exibições

Hi Wolfgang,

 

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

 

Luis

0 Kudos
Mensagem 8 de 11
6.502Exibições

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
Mensagem 9 de 11
6.497Exibições

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
Mensagem 10 de 11
6.476Exibições