Feature #5522 2012-04-20 20:53

kyis

CC: Enter to jump out of parentheses

It would be great if after an auto-complete resulting in the cursor being surrounded by parentheses or followed by one, pressing Enter would cause the cursor to jump after the nearest closing parenthesis.

That said it doesn't have to be necessarily after an auto-complete, it just happens that this situation generally occurs after one.

A good example of this behavior exists in eclipse if I remember correctly.

Applying this behavior to brackets might be questionable but it would certainly be useful for parentheses and square brackets.

Category
Editing
Status
Open
Close date
 
Assigned to
ollydbg
ollydbg 2012-04-25 14:29

I'm not fully understand your idea. But I guess press the TAB key will do what you want to.

Thanks.

kyis 2012-04-25 16:16

I'm sorry, I tested more thoroughly, and didn't even notice that CB was smart enough to place the cursor outside the parenthesis when a call does not need arguments.

In this case that simplify things, I'm going to try and clarify what I was suggesting:

-"|" represents the cursor -"*" represents any character

if function takes arguments but they're not mandatory or I decide to fill them later: *******(|) -> enter -> *******()|

if I typed my arguments: *******(***,***,****|) -> enter -> *******(***,***,****)| but if not *******(***,***,|) -> enter -> *******(***,***,\n |)

I hope this clarifies what I was looking for, it's sort of like an "I'm done here" key.

Depending on your keyboard layout you might not really see the point although it can be useful for everybody even if your layout isn't awkward, but some people wish they could have been there when they decided it so they could scream "are you nuts ?!". XD

kyis 2012-04-25 16:23

Sorry for splitting my message but I forgot to mention that I don't mind contributing this change myself if I'm capable enough and if I'm pointed toward the file(s) concerned.

Even if it's just to have people see for themselves if it's something they find useful or bothersome.

ollydbg 2012-04-26 00:19

Thanks, it is more clear now. You can use the TAB key to achieve this.

*******(***,***,****|) -> enter TAB key -> *******(***,***,****)|

This used to work, but I just find that it does not works in the nightly build rev7932, so sure how it cause this regression.

kyis 2012-04-26 02:15

I'm using the nightly rev7932, so it was working before ? I tried a few builds up to rev6992 and rev6283 (v10.05) and it didn't work in any of them. I find it odd that it would take so much time to spot (2yrs), I'm sure some people used this as much as the ";" key. Maybe a library causing mischiefs?

ollydbg 2012-04-26 04:36

I'm sure it works before, because I even it is implemented by Loaden, and it is called Smart tab. You can see there is a member variable: m_tabSmartJump in the file: cb_trunk\src\include\cbstyledtextctrl.h

I'm currently busy so hope someone can investigate this.

ollydbg 2012-04-28 07:53

OK, after some debugging under GDB, I can see that the smart jump works Ok.

Note: the smart jump is enabled automatically when you press a "(". After that, the right ")" will be jumped over when you press the TAB key. Also, the ")" will have the different color.

Comments are welcome.

kyis 2012-04-28 22:36

Odd, I can't seem to get it working, is there anything that could indirectly disable it?

Is typing "(" first mandatory for it to work or is it enabled as long as my cursor is inside parenthesis? (eg.: after an auto-complete)

ollydbg 2012-04-29 01:04

Quote: Is typing "(" first mandatory for it to work Yes.

I'm not sure why it does not works on your system, can you possible to debug it? (debug C::B under C::B, without this I can't give your more help)

I can't see there is an option to enable or disable this feature. So, it is always enabled.

kyis 2012-05-02 04:39

Just a quick message to say that I setup a build for testing, and am on it. I couldn't get the code dealing with smartTab into scope to debug it yet, even though it's supposed to run pretty frequently. I suspect the fact that I only had little time and placed the breakpoints in a hurry to be the problem.

I'll try again when I have enough time to actually focus on it.