Bug 454074 - ENTER doesn't move cursor to the next line
Summary: ENTER doesn't move cursor to the next line
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-03 22:44 EST by Ian Barkley CLA
Modified: 2020-09-04 15:23 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Barkley CLA 2014-12-03 22:44:22 EST
When I'm in the middle of a function definition, and press Enter to go to the next line, Eclipse takes me to the end of the line instead of inserting a newline. Please add a way to disable this annoying behavior.

More specifically, I type:

    <ENTER>if (GetSomeValue(inputFileName,

At this point, the line looks like (using | to indicate the position of the cursor):

     if (GetSomeValue(inputFileName,|))

after Eclipse automatically added two )'s.

But now, if I press <ENTER> to go to the next line, what I *want* is:

     if (GetSomeValue(inputFileName,
                      |))

but what I *get* is:

     if (GetSomeValue(inputFileName,))|

That is, the cursor has just jumped out of the parentheses to the end of the line, instead of going to the next line.

Multiple people have told me it is not possible to disable this behavior. Please add an option for this.

(If this wasn't obvious from the examples, I'm editing C++ code)
Comment 1 Dani Megert CLA 2014-12-08 13:39:09 EST
If this is during content assist (Ctrl+Space), then this is expect and won't change.
Comment 2 Nathan Ridge CLA 2014-12-08 14:01:12 EST
This is unrelated to content assist. It's related to the automating insertion of a closing parenthesis when an opening parenthesis is typed. When this happens, an <enter> just "accepts" the proposed closing parentheses, rather than going to the next line.

The automatic closing of parentheses can be disabled in Window -> Preferences -> C/C++ -> Editor -> Typing -> Automatically close -> (Parentheses) and [square] brackets.

However, it's possible that some users would prefer to have the automatic closing of parentheses, but not the modified <enter> behaviour. If so, we can add another option to the "Typing" preferences to control that.