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 88167

Summary: Overagressive use of number spaces per tab setting
Product: editor Reporter: _ gordonp <gordonp>
Component: SettingsAssignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P2    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 86751    

Description _ gordonp 2006-10-27 18:54:33 UTC
In the cnd Makefile editor I've overridden Formatter.expandTabs() so it
always returns false. When I open a Makefile with a new userdir and press
the Tab key it initially works as expected.

However, if I open Tools->Options and go to the Editor node and press the
Indentation tab (without changing anything), this changes. If I go back to
the same Makefile and enter a Tab, it now is replaced by 4 spaces (even
though my expandTabs() still returns false.

This is because Formatter.java's static String getIndentString(int, boolean,
int) is passed an initial indent of 4 (rather than the 8 I've set in my
MakefileFormatter class).

I do have a workaround (override the public getIndentString()) but its still
a bit of a kludge and should be fixed in the trunk. There is also potential
that other overagressive settings could cause further Makefile problems.
Comment 1 _ gordonp 2006-10-28 00:25:43 UTC
This does (still) have a direct affect on cnd and Makefiles.

If I type 2 tabs, they get expanded to "\t\t" (as expected). If I
open the Tools->Options and visit the Editor Indentation panel, then
typing 2 tabs gets "\t    " (1 tab followed by 4 spaces).
Comment 2 Miloslav Metelka 2006-12-06 09:02:01 UTC
The Options->Editor->Indentation panel is an oversimplification. We should
restore the state where the settings can be specific for individual languages
into 6.0.
Comment 3 Vitezslav Stejskal 2007-07-18 18:18:00 UTC
Please read issue #66187. Having Formatter.expandTabs() == false does *not* mean that you will ever only get \t in your
document. The three settings expandTabs, tabSize and spacesPerTab work together in rather complex way that is described
in #66187.

IMO, what you want for makefile documents is: expandTabs == false and spacesPerTab always copy the value of tabSize. The
tabSize setting is set through BaseOptions while the other two are on FormatterIndentEngine. You should override their
getters to enforce the above rule.

See also: issue #66187, issue #71936

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