Author Topic: How can I get auto close bracket/inverted commas?  (Read 11667 times)

Offline gcampton

  • Single posting newcomer
  • *
  • Posts: 5
How can I get auto close bracket/inverted commas?
« 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 ?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: How can I get auto close bracket/inverted commas?
« Reply #1 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
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How can I get auto close bracket/inverted commas?
« Reply #2 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.

Offline gcampton

  • Single posting newcomer
  • *
  • Posts: 5
Re: How can I get auto close bracket/inverted commas?
« Reply #3 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="_"

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How can I get auto close bracket/inverted commas?
« Reply #4 on: December 15, 2009, 04:56:04 pm »
You should use a recent nighly build, both features are implement in the meantime.

Offline gcampton

  • Single posting newcomer
  • *
  • Posts: 5
Re: How can I get auto close bracket/inverted commas?
« Reply #5 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How can I get auto close bracket/inverted commas?
« Reply #6 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.

Offline gcampton

  • Single posting newcomer
  • *
  • Posts: 5
Re: How can I get auto close bracket/inverted commas?
« Reply #7 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.

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: How can I get auto close bracket/inverted commas?
« Reply #8 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]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How can I get auto close bracket/inverted commas?
« Reply #9 on: December 17, 2009, 10:16:20 pm »
As I posted before:

You should use a recent nighly build, both features are implement in the meantime.

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: How can I get auto close bracket/inverted commas?
« Reply #10 on: December 17, 2009, 11:39:41 pm »
Thanks, I missed that part of the thread

Offline gcampton

  • Single posting newcomer
  • *
  • Posts: 5
Re: How can I get auto close bracket/inverted commas?
« Reply #11 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[])
{
 ...

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: How can I get auto close bracket/inverted commas?
« Reply #12 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.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How can I get auto close bracket/inverted commas?
« Reply #13 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.