Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 63520 - [typing] Smart cursor positioning fails on indentation by spaces
Summary: [typing] Smart cursor positioning fails on indentation by spaces
Status: RESOLVED DUPLICATE of bug 19036
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 trivial (vote)
Target Milestone: 3.0   Edit
Assignee: Tom Hofmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-22 08:22 EDT by Paweł Sakowski CLA
Modified: 2004-05-28 04:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paweł Sakowski CLA 2004-05-22 08:22:56 EDT
My Java Editor settings:

Displayed tab width: 4
Insert spaces for tabs: checked

Take the following Java file:

package foo;

class Test {
    void method() {
}

When I position the cursor after the method's opening brace and press Enter, two
new lines are added:
- 8 spaces
- 4 spaces, "}"

Which is right. However, the cursor gets positioned after the 5th space, not the
8th one.
Comment 1 Dani Megert CLA 2004-05-24 03:43:03 EDT
Tom, please comment
Comment 2 Tom Hofmann CLA 2004-05-24 12:36:42 EDT
reproducable, should fix for 3.0
Comment 3 Tom Hofmann CLA 2004-05-24 12:47:44 EDT
the reason is once more the preference split for indentation between the
formatter and the editor:

If you set the formatter preference to *not* use the Tab character for
indentation (Java->Code Style->Code Formatter, edit your profile), everything
works as expected.

Currently, the JavaAutoIndentStrategy tries to insert 4 spaces (the indentation
of the previous line) plus one Tab (the indentation unit according to the
formatter). However, the tab is converted to spaces by the editor. The new caret
offset is still set to 5 since the auto-indenter does not know about the conversion.
Comment 4 Tom Hofmann CLA 2004-05-28 04:06:22 EDT

*** This bug has been marked as a duplicate of 19036 ***