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 115997 - incorrect indents when not using default spaces per tab
Summary: incorrect indents when not using default spaces per tab
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Settings (show other bugs)
Version: 6.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords:
: 116318 116748 117827 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-09-19 14:00 UTC by mclaassen
Modified: 2007-11-05 13:42 UTC (History)
0 users

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 mclaassen 2007-09-19 14:00:02 UTC
This is a problem with the real-time editor.  Reformatting after the fact corrects the problem.

I have my settings set as:
[Editor options tab]
Expand tabs to spaces = false;
Number of space per indent = 2
Tab size = 2

If i type the text:
if (true) {

and then press return, my caret is indented 4 characters (implemented as 2 tabs)
It should have been indented only 1 tab (representing 2 characters)

Reformatting the file with Alt-Shift-F formats it correctly.
Comment 1 mclaassen 2007-09-19 17:07:25 UTC
I forgot to mention that this has not worked for a while and is still not working in 200709190000
Comment 2 mclaassen 2007-09-20 15:30:17 UTC
I am not sure if this has been looked at yet, but I have a follow-up comment.

I am starting to find this is really quite frustrating.  As I create and edit more and more complex methods, they are
almost unreadable.  Doing the Alt-Shift-F still fixes it, but it is pretty distracting to have to do this every couple
minutes just to make sure I wrote what I think I did.

I don't think NB6 should be released with this bug in it since it pretty much makes variable indent sizes unusable, so I
am requesting this get moved to P2.  

I understand that people generally think that their issues are the most important, so if you don't think custom indent
sizes are used enough to warrant a P2 issue, I would understand.  However, we have used them here for years and really
appreciate the extra information we can fit on our screens.  I sincerely would hope this can get fixed before FCS.

Thanks,
Mark
Comment 3 Jiri Prox 2007-09-21 10:58:07 UTC
This works as expected for me, have you changed another formatting setting? 
(Build 20070919053406)
Comment 4 mclaassen 2007-09-21 15:13:06 UTC
I don't think so.  Is there a file or something I can delete from my user directory that will reset my format settings
so I can be sure?  Not long ago I deleted the NB 6 user dir and re-imported my 5.5.1 settings.  I don't believe I have
changed anything since that.

Comment 5 Miloslav Metelka 2007-09-24 08:33:26 UTC
Could you please start NB with a different userdir http://wiki.netbeans.org/wiki/view/FaqAlternateUserdir to check
whether that makes any change? Thanks.
Comment 6 Jiri Prox 2007-09-24 11:02:53 UTC
I've finally reproduced it. It happened to me only when I set tab size and indentation size to 2 in 5.5.1 and then
import my settings to 6.0. The options shows that indentation is 2 but editor uses 4. 
To recover from the bug, I set indentation to another value (e.g. 3) and then back to 2 and all started to work fine.
Comment 7 Vitezslav Stejskal 2007-09-24 12:28:47 UTC
*** Issue 116318 has been marked as a duplicate of this issue. ***
Comment 8 Vitezslav Stejskal 2007-09-24 12:30:18 UTC
Thanks for evaluating this, Jirko.
Comment 9 mclaassen 2007-09-24 15:37:39 UTC
I tried the work-around for the issue mentioned by jiriprox (changing the indent size to 3 and then back to 2) and this
fixed the issue for me as well.  Having this work right makes a big difference!  Thanks for the tip.
Comment 10 Jiri Prox 2007-09-26 10:40:59 UTC
*** Issue 116748 has been marked as a duplicate of this issue. ***
Comment 11 mclaassen 2007-10-02 14:08:01 UTC
I was planning on reporting that this issue is spreading to the reformat command.  I have been getting dailies on a
regular basis and it seemed to be getting worse.  However, my initial tests of the new daily (200710020000) seem very
promising!
Comment 12 Petr Hrebejk 2007-10-02 16:39:43 UTC
Checking in FormatterImpl.java;
/cvs/editor/indent/src/org/netbeans/modules/editor/indent/FormatterImpl.java,v  <--  FormatterImpl.java
new revision: 1.8; previous revision: 1.7
done
Comment 13 Vitezslav Stejskal 2007-10-10 10:12:13 UTC
*** Issue 117827 has been marked as a duplicate of this issue. ***