Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: dmoore on December 08, 2012, 09:55:39 pm

Title: More smart indent...
Post by: dmoore on December 08, 2012, 09:55:39 pm
I have to say that I am finding SmartIdent pretty dumb at times  :P

If I have typed this:

Code
var1 + var2 + c*var3

then decide that I want to multiply var1 and var2 by a, so I move my cursor back to the start and type "b*(", I get

Code
b*(|)var1 + var2 + c*var3

Now I go and complete the brace and I have

Code
b*()var1 + var2)|

so I get that extra closing brace in there that shouldn't be there. (Same thing happens with quotes).

Maybe the "smart" thing to do is to automatically remove the added brace if the user moves without typing anything inside the braces? (That has problems with brace autocompletions for functions without args though)
Title: Re: More smart indent...
Post by: Alpha on December 09, 2012, 12:11:25 am
In that situation, I type with a slightly different habit:
|var1 + var2
type "b*"
b*|var1 + var2
press Shift-End (or Ctrl-Shift-Right) to select
b*var1 + var2|
type ")" (if selection brace completion is not active, you must press Alt-I first)
b*(var1 + var2)|

This sidesteps the problem, but actually solving it sounds to be a bit more difficult...
Title: Re: More smart indent...
Post by: oBFusCATed on December 09, 2012, 12:55:46 am
This sidesteps the problem, but actually solving it sounds to be a bit more difficult...
In fact it is pretty easy: Settings -> Editor -> Editor settings -> Brace completion -> Off

BTW: The Alt-I brace completion example has bad undo behaviour.