News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Indentation in cb

Started by erezz, October 28, 2013, 04:54:36 PM

Previous topic - Next topic

erezz

Suppose that I have this 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:


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


oBFusCATed

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!]

erezz

Quote from: oBFusCATed on October 28, 2013, 05:57:23 PM
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

Jenna

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 sudo dpkg-reconfigure codeblocks-contrib and make sure the appropriate plugins are selected.

erezz

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

Jenna

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.

erezz

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

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:


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

oBFusCATed

Quote from: erezz on October 29, 2013, 11:21:16 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!]

erezz

Quote from: oBFusCATed on October 29, 2013, 11:32:57 AM
Quote from: erezz on October 29, 2013, 11:21:16 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

oBFusCATed

(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!]