Code::Blocks
October 31, 2014, 12:12:11 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Code::Blocks Auto Format?  (Read 3655 times)
Goodkind
Newcomer
*
Offline Offline

Posts: 2


« 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
}
Logged
Alpha
Developer
Lives here!
*****
Offline Offline

Posts: 1382



« Reply #1 on: February 16, 2012, 04:24:59 am »

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:
Code:
while(true){
    |
}
(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.)
Logged
WantCbPersonalized
Newcomer
*
Offline Offline

Posts: 6


« Reply #2 on: October 13, 2012, 10:19:44 pm »

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.
Logged
MortenMacFly
Administrator
Lives here!
*****
Offline Offline

Posts: 8680



« Reply #3 on: October 14, 2012, 07:38:20 am »

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?
Logged

Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ
WantCbPersonalized
Newcomer
*
Offline Offline

Posts: 6


« Reply #4 on: October 14, 2012, 09:38:13 am »

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]
Logged
jens
Administrator
Lives here!
*****
Offline Offline

Posts: 6633



WWW
« Reply #5 on: October 14, 2012, 10:06:01 am »

Which version of C::B do you use ?
Logged

Regards

Jens  Debian - nightlies (and release) : http://apt.jenslody.de/ Fedora [18 - 20]- and CentOS/RedHat [5, 6 & 7] - nightlies : http://rpm.jenslody.de/
WantCbPersonalized
Newcomer
*
Offline Offline

Posts: 6


« Reply #6 on: October 14, 2012, 10:08:02 am »

10.05 with all plugins
Logged
jens
Administrator
Lives here!
*****
Offline Offline

Posts: 6633



WWW
« Reply #7 on: October 14, 2012, 10:37:00 am »

You should try a recent nightly: http://forums.codeblocks.org/index.php/board,20.0.html.
Logged

Regards

Jens  Debian - nightlies (and release) : http://apt.jenslody.de/ Fedora [18 - 20]- and CentOS/RedHat [5, 6 & 7] - nightlies : http://rpm.jenslody.de/
WantCbPersonalized
Newcomer
*
Offline Offline

Posts: 6


« Reply #8 on: October 14, 2012, 11:18:02 am »

I currently do not know what a nightly build is, but I will search a lot and come up with a response. Undecided
Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!