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.

Bug 86750 - Expand Tabs to Spaces flag is ignored
Summary: Expand Tabs to Spaces flag is ignored
Status: RESOLVED DUPLICATE of bug 66187
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 5.x
Hardware: Sun All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-09 08:33 UTC by alexandrov
Modified: 2007-11-05 13:39 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alexandrov 2006-10-09 08:33:45 UTC
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.
Comment 1 alexandrov 2006-10-09 08:45:24 UTC
For cnd module is very important this bug to be fixed ASAP. (See IZ 86751)
Comment 2 Miloslav Metelka 2006-10-09 14:40:10 UTC
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.
Comment 3 Vitezslav Stejskal 2006-10-16 13:00:18 UTC
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
Comment 4 Miloslav Metelka 2006-11-16 11:45:01 UTC
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
Comment 5 Jan Lahoda 2006-11-20 17:38:27 UTC
Please see also issue #87999.
Comment 6 Vitezslav Stejskal 2007-05-21 01:17:38 UTC

*** This issue has been marked as a duplicate of 66187 ***