Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Goodkind on February 10, 2012, 09:25:09 pm
-
Hello,
I have noticed that Code::Blocks will do some auto formating when entering a open bracket on a new line. The closing bracket is automaticly placed two lines down and the cursor is one line down and indented.
I've gone through the manual and found Astyle. After some expermentation and some reading on the forums it appears that is only for formating code that is already all typed out.
Is there a way to change the default behavior of the opening bracket? My format style is slightly different. What I do is:
While(true){
statement block
}
-
From what I can tell, Code::Blocks is simply trying to guess your style from how you type; try typing:
while(true){
then pressing enter. For me, this produces the following:
(The pipe "|" symbol being the new location of the cursor.)
Does Code::Blocks do something different on your computer?
(By the way, sorry, it appears your post got lost.)
-
The same thing happens to me, as Goodkind said, and my style is like his. To me is not happening the same as for you, Alpha, if i press enter when you say the } goes the next line WITHOUT indentation like it used to happen in 8.02. What setting have you made to happen like that to you? I am very curious.
-
What setting have you made to happen like that to you? I am very curious.
I'd say: enable smart indenting...?! Did you try the related editor options already?
-
If you refer to trying all the possible combinations that are available in setting, yes I have done that. Also, Setting - Editor - Source formatter seems to affect the code only when you manually format it with AStyle, and this works only if the code is already written. I have attached a screenshot with General setting from editor. One more thing, Source Formatter in setting is set to banner, that is how I like my code to be. I've tried custom, but no big difference happens, or I may be missing something. The "smart" thing seem to happen in a different way.
while(true)
|
now, if I type "{" the following thing will happen:
while(true)
{
|
}
this is good, but I was wondering if it could happen the way Alpha says. If I do like he said:
while(true){|}
now press Enter
while(true){
|}
Am I missing something? If I disable brace completion:
while(true){|
now Enter
while(true){
|
[attachment deleted by admin]
-
Which version of C::B do you use ?
-
10.05 with all plugins
-
You should try a recent nightly: http://forums.codeblocks.org/index.php/board,20.0.html (http://forums.codeblocks.org/index.php/board,20.0.html).
-
I currently do not know what a nightly build is, but I will search a lot and come up with a response. :-\