Code::Blocks Forums

User forums => Help => Topic started by: ordak on February 17, 2018, 11:25:03 am

Title: Indentation ignored
Post by: ordak on February 17, 2018, 11:25:03 am
Hi,

When I write C code in a line and press Enter, The cursor goes to the beginning of next line. At times this would be ignoring of indentation. What can I do in this regard ?
Title: Re: Indentation ignored
Post by: oBFusCATed on February 17, 2018, 11:32:34 am
Do you have the SmartIndentCpp plugin enabled?
Title: Re: Indentation ignored
Post by: ordak on February 17, 2018, 12:46:11 pm
Do you have the SmartIndentCpp plugin enabled?

Yes, it is already enabled.
Title: Re: Indentation ignored
Post by: oBFusCATed on February 17, 2018, 03:17:33 pm
Then you should post the exact steps needed to reproduce the problem on a simple example file.
Title: Re: Indentation ignored
Post by: ordak on February 17, 2018, 03:42:33 pm
Then you should post the exact steps needed to reproduce the problem on a simple example file.

Consider this:

Code
#include <stdlib.h>
#include <stdio.h>

const static char SI[]="name.ex";

int main(int argc, char *argv[])
{
    int i = 0;
    for (i = 0; i < argc; i++) {
        printf("argv[%d] = %s\n", i, argv[i]);
    }

    printf("%s \n",SI);
    return EXIT_SUCCESS;
}

Now I click to the end of last printf and I press Enter:

Code

#include <stdlib.h>
#include <stdio.h>

const static char SI[]="name.ex";

int main(int argc, char *argv[])
{
    int i = 0;
    for (i = 0; i < argc; i++) {
        printf("argv[%d] = %s\n", i, argv[i]);
    }

    printf("%s \n",SI);
//cursor comes to the beginning of this line.
    return EXIT_SUCCESS;
}


Same happens for first printf too.
Title: Re: Indentation ignored
Post by: oBFusCATed on February 17, 2018, 04:14:12 pm
Works correctly for me...

Are you sure you have the auto indent or smart indent or whatever it is called enabled?
Title: Re: Indentation ignored
Post by: stahta01 on February 17, 2018, 05:08:39 pm
Settings -> Editor
Indent option make sure "Auto Indent" is checked.

Tim S.
Title: Re: Indentation ignored
Post by: ordak on February 18, 2018, 05:24:04 am
Settings -> Editor
Indent option make sure "Auto Indent" is checked.

Tim S.

Ok, I enabled "Auto Indent" as you said, and the problem seems to be gone.