Home Download Buy Blog Forum Support

Auto-ident when putting curly braces around block

Auto-ident when putting curly braces around block

Postby MaybiusStrip on Fri Sep 20, 2013 5:11 am

How do I modify the auto-ident settings when wrapping a block in curly quotes?

Right now the default behavior almost always yields undesired results. Instead of just adding a tab to the block, it adds the current indentation to the next line.

Here's an example. Let's say I have these two lines of code.

Code: Select all
doSomething();
doSomethingElse();


I want to wrap the second line in an if block, so on the line above it type if, then select the next three lines, and press "{", here is the result:

Code: Select all
doSomething();
if {
doSomethingElse();
}


Hmm, not what I wanted, guess I have to indent the code myself. But say we were indented 6 spaces (tabs are 2 spaces in the example) because we were already nested three levels deep, like so:
Code: Select all
      doSomething();
      doSomethingElse();


And by the same procedure, I add an "if" keyword 6 spaces in at the top (where it belongs relative to the code above it), then select the next three lines, and press "{"
Code: Select all
      doSomething();
      if {
            doSomethingElse();
      }


Now the code in it is indented 12 spaces instead of 8! I have to selected it and press shift+tab twice to get it where I want.

For a tool that's usually amazingly intuitive this seems like very unusual behavior. Is there any way I can change this myself? I tried overwriting the bracket key bindings in my User/Default keymap but they don't seem to override anything (even though I thought it took precendence?)
MaybiusStrip
 
Posts: 1
Joined: Fri Sep 20, 2013 4:50 am

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 11 guests