News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Indentation ignored

Started by ordak, February 17, 2018, 11:25:03 AM

Previous topic - Next topic

ordak

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 ?
Code::Blocks SVN
OS : Ubuntu LTS

oBFusCATed

Do you have the SmartIndentCpp plugin enabled?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ordak

Quote from: oBFusCATed on February 17, 2018, 11:32:34 AM
Do you have the SmartIndentCpp plugin enabled?

Yes, it is already enabled.
Code::Blocks SVN
OS : Ubuntu LTS

oBFusCATed

Then you should post the exact steps needed to reproduce the problem on a simple example file.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ordak

Quote from: 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.

Consider this:


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



#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.
Code::Blocks SVN
OS : Ubuntu LTS

oBFusCATed

Works correctly for me...

Are you sure you have the auto indent or smart indent or whatever it is called enabled?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

stahta01

Settings -> Editor
Indent option make sure "Auto Indent" is checked.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

ordak

Quote from: stahta01 on February 17, 2018, 05:08:39 PM
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.
Code::Blocks SVN
OS : Ubuntu LTS