News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

More smart indent...

Started by dmoore, December 08, 2012, 09:55:39 PM

Previous topic - Next topic

dmoore

I have to say that I am finding SmartIdent pretty dumb at times  :P

If I have typed this:


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


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


Now I go and complete the brace and I have


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)
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Alpha

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...

oBFusCATed

#2
Quote from: Alpha on December 09, 2012, 12:11:25 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]