Author Topic: Indentation in cb  (Read 7120 times)

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Indentation in cb
« on: October 28, 2013, 04:54:36 pm »
Suppose that I have this code:

Code
void foo(int a)
{
        int b;

}

If I put the cursor in line 4 (below "int b;"), it is located at the beginning of the line. Now, if I click the "Enter" key, I would expect the cursor to be at the beginning of the line + one tab. Instead, it is located at the beginning of the line. This is annoying when you write lots of code.

Another issue:

Code
void foo1(int a, int b)
{
        printf("abcd %d %d",);
}

Now, I put the cursor after the "," in the printf line. I click the "Enter" key, and the cursor moves to the next line below the "p" char. How can I make it be below the opening " char (i.e one tab + strlen("printf") + 2 from the beginning of the line)?

Thanks,
Erez


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indentation in cb
« Reply #1 on: October 28, 2013, 05:57:23 pm »
Do you have the SmartIndent plugins installed and 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 erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Indentation in cb
« Reply #2 on: October 29, 2013, 07:41:41 am »
Do you have the SmartIndent plugins installed and enabled?

Seems that I don't have it. I was hoping to find this plugin here: http://wiki.codeblocks.org/index.php?title=SmartIndent_plugin, but the page is empty. Where can I install it from?

Thanks,
Erez

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Indentation in cb
« Reply #3 on: October 29, 2013, 07:59:29 am »
It depends on your OS and from where you installed C::B.
If you are on linux, you have to install the codeblocks-contrib packages.
If you are on debian and have the codeblocks-conrib packages installed, you might need to run
Code
sudo dpkg-reconfigure codeblocks-contrib
and make sure the appropriate plugins are selected.

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Indentation in cb
« Reply #4 on: October 29, 2013, 09:48:24 am »
It depends on your OS and from where you installed C::B.
If you are on linux, you have to install the codeblocks-contrib packages.
If you are on debian and have the codeblocks-conrib packages installed, you might need to run
Code
sudo dpkg-reconfigure codeblocks-contrib
and make sure the appropriate plugins are selected.

I'm using Ubuntu 12.04. I don't have the codeblocks-contrib packages installed. If I installed C::B from the svn tree, do I need to generate this package with a specific 'make' command or do I need to download the codeblocks-contrib packages from the network?

Thanks,
Erez

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Indentation in cb
« Reply #5 on: October 29, 2013, 09:55:04 am »
If you build from sources, you need to run configure with the --with-contrib-plugins=xxx parameter, where xxx is either all for all contrib-plugins or any comma-seperated list of contrib-plugins.
Call configure with --help to see the exact spelling.

Offline erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Indentation in cb
« Reply #6 on: October 29, 2013, 11:21:16 am »
If you build from sources, you need to run configure with the --with-contrib-plugins=xxx parameter, where xxx is either all for all contrib-plugins or any comma-seperated list of contrib-plugins.
Call configure with --help to see the exact spelling.

Thanks. I was able to use the SmartIndentCPP plugin. This solved the problem that I described in foo1() but didn't solve the problem in foo().

And here's another problem:

Code
void foo2(int a, int b)
{
        printf("abcd %d %d",
               a,
               b);
}

If I put the cursor in line 5 just after the ";" char and click "Enter", I would expect that the cursor will jump to the next line, 1 tab after the beginning of the line. Instead, it is located below the "b" char (i.e. still indented for the printf() function). This seems wrong to me.

Erez

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indentation in cb
« Reply #7 on: October 29, 2013, 11:32:57 am »
This seems wrong to me.
In fact this is a very cool feature (at least for me).

To disable it Settings -> Editor -> General -> Indent -> Brace Smart Indent
(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 erezz

  • Multiple posting newcomer
  • *
  • Posts: 53
Re: Indentation in cb
« Reply #8 on: October 29, 2013, 11:58:24 am »
This seems wrong to me.
In fact this is a very cool feature (at least for me).

To disable it Settings -> Editor -> General -> Indent -> Brace Smart Indent

I tried to check/uncheck "Brace Smart Indent". I didn't see any difference in the foo2 test.

Erez

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Indentation in cb
« Reply #9 on: October 29, 2013, 12:50:52 pm »
Works as expected here.
(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!]