Author Topic: Indentation ignored  (Read 3275 times)

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 105
    • My Site
Indentation ignored
« 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 ?
Code::Blocks SVN
OS : Ubuntu LTS

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indentation ignored
« Reply #1 on: February 17, 2018, 11:32:34 am »
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!]

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 105
    • My Site
Re: Indentation ignored
« Reply #2 on: February 17, 2018, 12:46:11 pm »
Do you have the SmartIndentCpp plugin enabled?

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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indentation ignored
« Reply #3 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.
(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!]

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 105
    • My Site
Re: Indentation ignored
« Reply #4 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.
Code::Blocks SVN
OS : Ubuntu LTS

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indentation ignored
« Reply #5 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?
(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!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Indentation ignored
« Reply #6 on: February 17, 2018, 05:08:39 pm »
Settings -> Editor
Indent option make sure "Auto Indent" is checked.

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

Offline ordak

  • Multiple posting newcomer
  • *
  • Posts: 105
    • My Site
Re: Indentation ignored
« Reply #7 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.
Code::Blocks SVN
OS : Ubuntu LTS