Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: gcampton on December 15, 2009, 03:55:45 pm

Title: How can I get auto close bracket/inverted commas?
Post by: gcampton on December 15, 2009, 03:55:45 pm
Hello,
This is a standard function of most text editors, that code-blocks and another ms product that shall remain unnamed don't seem to come with as standard...

I thought the long awaited jump from text editor(VI) to IDE would be a painful process and hence I put it off for a little over 7months. Anyway, back to the topic, I can't seem to find where to enable this, I tried making a autocompletion (ctrl +J) function called by pressing {{ and ctrl J, this didn't work.

can anyone please shed some light on how I can get automatic closing brackets and/or inverted commas ?
Title: Re: How can I get auto close bracket/inverted commas?
Post by: ollydbg on December 15, 2009, 04:06:58 pm
Sorry, I can't fully understand your question.
Did you want to jump from the open brace to close brace?? just use CTRL+SHIFT+B. :D
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Jenna on December 15, 2009, 04:11:23 pm
It would be really helpful to know which version of C::B you use and which os (and version) you use.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: gcampton on December 15, 2009, 04:49:46 pm
CB 8.02 windows 7.

on a large number of text editors when you open a new brace '{' bracket '(' '[' an enclosing one is put directly after the cursor. or in case of the curly brace is put 2 lines below and the cursor jumps the to the next line with -> 1 indent. less frequent editors also have this inclusion for inverted commas. so when you type one, a second one(closing comma) is placed directly after the cursor.

eg _ = cursor
Code
// i type {
{
   _     
}

// i type (
int main(_)

// i type [
int [_]

// i type "
string str1="_"
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Jenna on December 15, 2009, 04:56:04 pm
You should use a recent nighly build (http://forums.codeblocks.org/index.php/board,20.0.html), both features are implement in the meantime.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: gcampton on December 15, 2009, 05:14:23 pm
Are you sure?
I just downloaded and installed the Nov (svn 5911) release and it's not working.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Jenna on December 15, 2009, 05:29:55 pm
You have to check "Settings -> Editor... -> General settings -> Indent options -> Brace completion" and it works only for C/C++- and D-sources/headers.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: gcampton on December 15, 2009, 05:32:07 pm
thank you, for some reason it was ticked but was just being buggy, when I closed it down and restarted the computer it worked.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Greatwolf on December 17, 2009, 10:03:12 pm
Hi,

I'm looking for the same feature as the OP but I can't seem to find "Brace Completion" checkbox here.



[attachment deleted by admin]
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Jenna on December 17, 2009, 10:16:20 pm
As I posted before:

You should use a recent nighly build (http://forums.codeblocks.org/index.php/board,20.0.html), both features are implement in the meantime.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Greatwolf on December 17, 2009, 11:39:41 pm
Thanks, I missed that part of the thread
Title: Re: How can I get auto close bracket/inverted commas?
Post by: gcampton on December 18, 2009, 05:10:44 pm
This is still kind of buggy, sometimes this doesn't work at all, for instance in non cpp file types.
Sometimes it doesn't work in cpp files either if I'm outside of a class block or something... But then other times it does.

Would love to see auto comment completion as well.  :shock:
/* enter :

Code
/*
 * _
 */

and for javadocs, /**
Code
/**
 * _
 *
 * @param argc
 * @param argv
 * @return
 *
 **/
int main(int argc,char *argv[])
{
 ...
Title: Re: How can I get auto close bracket/inverted commas?
Post by: blueshake on December 19, 2009, 01:12:49 am

Quote
This is still kind of buggy, sometimes this doesn't work at all, for instance in non cpp file types.
it works only for C/C++- and D-sources/headers.
Title: Re: How can I get auto close bracket/inverted commas?
Post by: Jenna on December 19, 2009, 11:39:38 am

Quote
This is still kind of buggy, sometimes this doesn't work at all, for instance in non cpp file types.
it works only for C/C++- and D-sources/headers.

Exact what I wrote before:
You have to check "Settings -> Editor... -> General settings -> Indent options -> Brace completion" and it works only for C/C++- and D-sources/headers.

Please read the posts carefully.

And for the not working brace-completion in c/cpp-files, please post exactly what you do if it happens, so anyone can reproduce it.