Bug 28454 - indentation has gone wrong
Summary: indentation has gone wrong
Status: RESOLVED DUPLICATE of bug 29909
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 28005 30155 30194 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-12-17 05:27 EST by Nikolay Metchev CLA
Modified: 2003-02-10 10:11 EST (History)
6 users (show)

See Also:


Attachments
Fixes Indentation Problems. (1.29 KB, patch)
2003-01-29 20:36 EST, Nikolay Metchev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Metchev CLA 2002-12-17 05:27:46 EST
I have set my tabs to be 3 spaces long:
----------------
public class C
{<---place cursor here
}
--------------------
when you press enter

class C
{
        |<---cursor ends up here (8 spaces in)
}
-------------------
this looks like the same bug as 26590
Comment 1 Nikolay Metchev CLA 2002-12-20 03:53:08 EST
PLEASE FIX THIS. It is really annoying!
Comment 2 Nikolay Metchev CLA 2003-01-23 04:48:24 EST
I have investigated a litte further and have found that if you go into Window-
>Preferences->Code Formatter->Style
and untick "Insert Tabs for indentation, not spaces" then the problem is 
apparent. Once again I must insist that this is a really really annoying bug 
and I hope it is looked at by someone!
Comment 3 Nikolay Metchev CLA 2003-01-28 22:13:54 EST
Further investigation has revealed that if I have set my Displayed tab width to 
8 (Window->Preferences->Java->Editor->Appearance). If I set my displayed tab 
width to 3 then the problem does not occur. Therefore someone is using the 
wrong variable some place!
Comment 4 Nikolay Metchev CLA 2003-01-29 05:15:03 EST
the method in file 
--------------
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.ui/ui/org/eclipse/jdt/i
nternal/ui/text/java/JavaAutoIndentStrategy.java?rev=1.28&content-
type=text/vnd.viewcvs-markup&cvsroot=Eclipse_Project
----------------
private int getTabWidth() {
		if (fTabWidth == -1)
			fTabWidth= JavaPlugin.getDefault().getPreferenceStore
().getInt(PreferenceConstants.EDITOR_TAB_WIDTH);
		return fTabWidth;
	}
----------------
should be
-----------------
private int getTabWidth() {
		if (fTabWidth == -1)
			fTabWidth= JavaCore.getOptions().get
(JavaCore.FORMATTER_TAB_SIZE);
		return fTabWidth;
	}

But I am not experience with eclipse development nor do I have rights to modify 
the code so could somebody check to see if this is correct and if so implement 
it.


Comment 5 Kai-Uwe Maetzel CLA 2003-01-29 08:58:40 EST
Adapting priority.
Comment 6 Nikolay Metchev CLA 2003-01-29 20:36:28 EST
Created attachment 3223 [details]
Fixes Indentation Problems.

The previous code was using the display tab size to calculate the indentation
to use. The patch will now ensure that FORMATTER_TAB_WIDTH is used in instead.
Comment 7 Neil Swingler CLA 2003-02-03 10:03:07 EST
The following are all dups of this:

bug 28005
bug 29909
bug 30194

It's very annoying as now I need to have my displayed tab width set to my desired
indent spacing of 2. I would like to use a tab width of 8 so that the JDK sources
are readable.
Comment 8 Nikolay Metchev CLA 2003-02-03 10:07:16 EST
I have created a patch for this bug. Its just a matter of time before somebody 
with commit privilages actually applies it to the source code. It is attatched 
to this bug report. If you can't wait you can try and check out the source code 
and apply the patch yourself.
Comment 9 Kai-Uwe Maetzel CLA 2003-02-10 10:06:33 EST
*** Bug 30155 has been marked as a duplicate of this bug. ***
Comment 10 Kai-Uwe Maetzel CLA 2003-02-10 10:09:43 EST
*** Bug 28005 has been marked as a duplicate of this bug. ***
Comment 11 Kai-Uwe Maetzel CLA 2003-02-10 10:10:32 EST
*** Bug 30194 has been marked as a duplicate of this bug. ***
Comment 12 Kai-Uwe Maetzel CLA 2003-02-10 10:11:00 EST

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