Page 1 of 1

Indenting and moving over indents

Posted: Mon Oct 24, 2005 2:12 pm
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.

Posted: Mon Oct 24, 2005 11:26 pm
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

Posted: Mon Oct 24, 2005 11:46 pm
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

Posted: Tue Oct 25, 2005 8:32 am
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.

Posted: Tue Oct 25, 2005 10:35 am
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.

Posted: Tue Oct 25, 2005 10:55 am
by jussij
I see what you mean. I will add this to the bug list :(

Cheers Jussi

Posted: Mon Oct 31, 2005 3:44 am
by jussij
This is feature is hopefully working better in the latest patch :)

Cheers Jussi