| Summary: | [typing] Smart cursor positioning fails on indentation by spaces | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Paweł Sakowski <pawel> |
| Component: | Text | Assignee: | Tom Hofmann <eclipse> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | trivial | ||
| Priority: | P3 | CC: | daniel_megert |
| Version: | 3.0 | ||
| Target Milestone: | 3.0 | ||
| Hardware: | PC | ||
| OS: | Linux-GTK | ||
| Whiteboard: | |||
Tom, please comment reproducable, should fix for 3.0 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. |
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.