This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Open any project. Open Tools/Options/Editor/Indentation. Turn off flag "Expand Tabs to Spaces", Push OK. Push Source/Reformat Code. Check the result: in every line with leading indent(not equal to 8 spaces) spaces are leading not Tab.
For cnd module is very important this bug to be fixed ASAP. (See IZ 86751)
Only the multiplies of tab size (Tools->Options->Advanced Options->Editor Settings-><editor-type>->Tab Size) will be replaced by the physical \t character. You may want to change the Tab Size to 4 to have the 4 spaces displayed per a single \t character.
Should be fixed now. The tab size was effectively set to 8 characters no matter what the Tools/Options settings were. The problem was that there are two properties in the Formatter class - tabSize and spacesPerTab - the Tools/Options uses the latter one while the formatting code uses the former one. I've bridged the tabSize property to the spacesPerTab so they should now always be the same. Otherwise the behavior is exactly as described by Mila - only every spacesPerTab spaces are replaced by one tab character. The rest of spaces is left unchanged. Eg: Having two leading spaces on a line and spacesPerTab == 4 the reformat code won't change anything; 6 leading spaces will become 1 tab and 2 spaces, etc. Checking in Formatter.java; /cvs/editor/libsrc/org/netbeans/editor/Formatter.java,v <-- Formatter.java new revision: 1.40; previous revision: 1.39 done Checking in SettingsDefaults.java; /cvs/editor/libsrc/org/netbeans/editor/SettingsDefaults.java,v <-- SettingsDefaults.java new revision: 1.63; previous revision: 1.62 done
Sorry but I have to rollback this fix because many e.g. JDK sources relies on tabSize=8 while this fix means the tabSize=4 so this makes the indentation of those sources to look strange. I understand that we need at least a better UI for setting of the indentation related things. It should happen for during 6.0 development because we are already rewriting the old BaseOptions (that contained tabSize) were separate under Advanced Options to be on the same level with the other editor indentation options. Rollback: Checking in libsrc/org/netbeans/editor/Formatter.java; /cvs/editor/libsrc/org/netbeans/editor/Formatter.java,v <-- Formatter.java new revision: 1.41; previous revision: 1.40 done Checking in libsrc/org/netbeans/editor/SettingsDefaults.java; /cvs/editor/libsrc/org/netbeans/editor/SettingsDefaults.java,v <-- SettingsDefaults.java new revision: 1.64; previous revision: 1.63
Please see also issue #87999.
*** This issue has been marked as a duplicate of 66187 ***