Indenting and moving over indents

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
martinlooker
Posts: 20
Joined: Tue Oct 11, 2005 12:55 pm

Indenting and moving over indents

Post by martinlooker »

Our software house style for indienting is like this

Code: Select all

    if (i == 0)
        {
        i = i + 1;
        }
    else
        {
        i = i - 1;
        }
I'm currently working with the smart indent and smart bracing turned off. I have a tab size of 4 and have tried the following with indent size of 0 and 4.

When I'm coding like the above I find that when I enter the if { }, then press enter after the closing }, then press tab that first tab tabs out to the level of the } when it ought to tab out to the level of the if. The only way I get the cursor lined up with the if is to go tab tab backspace backspace, which doesn't seem quite right. Basically the first tab I enter on a line actually moves in two tab spaces. Is this some configuration option I need to change ?

It would also be nice to use the Smart Indenting and Smart Bracing features, though I realise my companies coding style often prevents that, is it possible to use the Smart features with this style ?

Once again thanks for your patience, I'm trying to get over the hurdle of setting Zeus up with my editing preferences, (moving from a finely tuned Brief setup), and am struggling to understand how many of the options work.

Edit: just to add Zeus seems to be treating cursor movement in whitespace at the begginning of all lines differently to movement in lines once the text part is reached.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

When I'm coding like the above I find that when I enter the if { }, then press enter after the closing }, then press tab that first tab tabs out to the level of the } when it ought to tab out to the level of the if. The only way I get the cursor lined up with the if is to go tab tab backspace backspace, which doesn't seem quite right. Basically the first tab I enter on a line actually moves in two tab spaces. Is this some configuration option I need to change ?
Use the Options, Editor Options menu to edit the keybaord mapping and map the Tab key to use the Tab keyboard function.

Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

It would also be nice to use the Smart Indenting and Smart Bracing features, though I realise my companies coding style often prevents that, is it possible to use the Smart features with this style?
As a test I opened the C/C++ document type, went to the templates section, turned on smart indenting, smart bracing and set the indent braces style and for me these settings seemed to work just fine :?

When I type in this code (ie the | is the cursor):

Code: Select all

  if ()
  {|
after hitting the enter key, I get the following indented code:

Code: Select all

  if ()
    {
    |
    }
Jussi
martinlooker
Posts: 20
Joined: Tue Oct 11, 2005 12:55 pm

Post by martinlooker »

Thanks for that I get it now <smacks head>

I was typing
if () [ENTER] [TAB] { [ENTER] ...

Which resulted in

Code: Select all

    if ()
        {
             |
        }
That TAB before the brace then seems to cause the extra indentation for the text within the brace, I just need to leave that out and trust Zeus to do it for me, I guess that is what Smart Indenting is.
martinlooker
Posts: 20
Joined: Tue Oct 11, 2005 12:55 pm

Post by martinlooker »

I played with this a little more, its not quite respecting this style of indenting.

If I work as described above that is fine for adding new brace sets. But if I have to add a new line just after an existing, already indented, { then I get that extra indent as in my example above.

I can live without auto indenting, I just though I'd let you know what I'm finding.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

I see what you mean. I will add this to the bug list :(

Cheers Jussi
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

This is feature is hopefully working better in the latest patch :)

Cheers Jussi
Post Reply