Bug 231879 - Unable to disable all automatic indentation and random carriage returns across the editor
Unable to disable all automatic indentation and random carriage returns acros...
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Formatting & Indentation
7.4
All All
: P2 (vote)
: Dev
Assigned To: Dusan Balek
issues@editor
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-26 22:25 UTC by qazzi76
Modified: 2017-05-12 01:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description qazzi76 2013-06-26 22:25:30 UTC
Netbeans doesn't offer a simple checkbox to disable ALL automatic indentation in the HTML, Javascript, php, CSS Editors

I and I'm sure many others like to code without having to reformat the text due to unexpected indentation and carriage returns and would like some way of turning of this function altogether.

The inability to set indentation to "0" in "Tools>Options>Editor> Formatting >All Languages>'Number of Spaces per Indent'" is very unfortunate as it always adds indents an option to totally disable this.

Thanks in advance for any assistance anyone can offer with this.
Comment 1 Dusan Balek 2013-06-27 09:28:17 UTC
Fixed in jet-main. Indentation can be set to "0" in "Tools>Options>Editor> Formatting >All Languages>'Number of Spaces per Indent'"

http://hg.netbeans.org/jet-main/rev/5c1e1e8f63e0
Comment 2 qazzi76 2013-06-28 19:59:42 UTC
Hi Dusan,

Thank you so much for you input on this.

Can you confirm that your indentation "0" implementation will function across all editors used in the Netbeans Web package (css, php, js, html)?

Once again thanks for your assistance with this.

Regards,
Comment 3 Quality Engineering 2013-07-01 15:54:39 UTC
Integrated into 'main-silver', will be available in build *201307011244* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5c1e1e8f63e0
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #231879: Unable to disable all automatic indentation - fixed.
Comment 4 qazzi76 2013-07-03 10:28:01 UTC
I have now had a chance to test this and I'm afraid it doesn't fully work...

Once indentation is set to 0 and you go back to the editor and try typing some code and pressing enter to get to a new line, all it does is give the below Exception error:





java.lang.IllegalArgumentException: startOffset=110973 >= endOffset=110973
	at org.netbeans.api.editor.fold.Fold.<init>(Fold.java:137)
	at org.netbeans.api.editor.fold.FoldHierarchy$ApiPackageAccessorImpl.createFold(FoldHierarchy.java:371)
	at org.netbeans.modules.editor.fold.FoldOperationImpl.createFold(FoldOperationImpl.java:170)
	at org.netbeans.spi.editor.fold.FoldOperation.addToHierarchy(FoldOperation.java:204)
	at org.netbeans.modules.editor.fold.FoldOperationImpl$Refresher.run(FoldOperationImpl.java:660)
	at org.netbeans.modules.editor.fold.FoldOperationImpl.update(FoldOperationImpl.java:487)
	at org.netbeans.spi.editor.fold.FoldOperation.update(FoldOperation.java:406)
	at org.netbeans.modules.csl.editor.fold.GsfFoldManager$CommitFolds.run(GsfFoldManager.java:694)
	at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1383)
	at org.netbeans.modules.csl.editor.fold.GsfFoldManager$CommitFolds.run(GsfFoldManager.java:660)
	at org.netbeans.modules.csl.editor.fold.GsfFoldManager$JavaElementFoldTask.run(GsfFoldManager.java:384)
	at org.netbeans.modules.csl.editor.fold.GsfFoldManager$JavaElementFoldTask.run(GsfFoldManager.java:268)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:568)
[catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:744)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
Comment 5 Jiri Prox 2013-07-08 09:15:23 UTC
The exception is already reported as separate issue 229782
Comment 6 RAM518 2014-05-12 01:06:05 UTC
Sorry but this bug is not fixed. The user request was for a single box which they can select which will turn off "all auto-indentation" within Netbeans. In the latest version, I see options for a setting of the number of spaces per indent, per language, but no box which says "turn off auto-indent everywhere".

So, when I click on Tools->Options->Formatting, I select my language and then I deselect "Use All Languages Settings", then I set the number of spaces per indent to 0. Then I click "Apply", then I close the settings window.

Then I press Enter while my document is selected. I get a carriage return with 4 spaces after it! What? Why am I seeing indent spaces?

I now click on Tools->Options->Formatting, and "Use All Languages Settings" is selected, and "Number of Spaces per Indent" is set to 4. So, it doesn't save the setting, it doesn't apply it when you click apply. There is no way to turn off auto-indent, at all!

I just want the IDE to have the option of not inserting spaces without me clicking the tab or space button!
Comment 7 RAM518 2014-05-12 01:23:02 UTC
Also, I've noticed that if you hit enter in the middle of already-formatted code, it sometimes *deletes* spaces or tabs in front of the non-whitespace characters. What Netbeans needs is the ability to have the Enter button do *nothing but insert a carriage return*.
Comment 8 Dusan Balek 2014-05-12 08:01:43 UTC
What is the language that you are editing? Seems to work fine in Java using the current dev build. Thanks.
Comment 9 waldermort 2015-01-17 02:06:30 UTC
What is the status of this?

Even with tab spaces set to 0, hitting return while editing a twig/html file still causes a certain number of tabs to be placed before the cursor. Like an above commenter stated, when need the option to disable it altogether and ONLY insert a carriage return.
Comment 10 waldermort 2015-01-17 02:25:59 UTC
To further on my above comment.

The current implementation of adding tabs (especially within twig files) is wrong. I get the impression that the editor is looking at the whole DOM to decide how many tabs a line should have. Take the following example:

<header>
    <nav>
        <div>
            {#<div></div>#}
        </div>
    </nav>
</header>

Place the cursor after the closing header tag and hit return. TWO indents are inserted. Shift Tab twice to correct and try inserting a <div>. Upon hitting '>' it is re-indeted. Fix it and add a closing </div>, same problem. Fix it. You should now have:

</header>
<div></div>

Place the cursor inside the div and hit return. Guess what, SAME PROBLEM!

If the correct indentations cannot be added (which I understand may take some time to correct), then at least give us the option of disabling it.
Comment 11 Echo89 2015-10-26 17:06:48 UTC
I'd also like to put in my two cents.

This is really getting annoying now, and it's been 2 years since the issue has been filed. I am REQUIRED to use Netbeans in work for my web development, however this indentation issue is really starting to get on my nerves. It is DEFACTO-STANDARD that an IDEs should present the user with an option to DISABLE all smart-indenting.

When I indent a line, it is for a specific reason, which Netbeans seems to have a problem with. It will sometimes "correct" my indention, INCORRECTLY.

Netbeans is not very accommodating for any code-style other than the creator's.

That's not very good now, is it?

Perhaps you should be doing SOMETHING about this since it's been dragging on for two years.

And before you hit me hard with "we're volunteers!", let me just say that indentation and accommodation for an eclectic range of code-styles is a fundamental part of an editor, as you use it constantly. And when there is an OBVIOUS error, reported by lots of different people, you should *probably* fix it.

Sorry for any condescending tones conveyed in the above paragraphs, but these kinds of issues NOT being fixed is quite irritating, especially when my job REQUIRES I code in Netbeans.
Comment 12 sephjfox 2016-09-01 12:20:24 UTC
I am having this issue
    Right now
         And it is infuriating
            I changed all indents to zero
                But it keeps on indenting
Comment 13 Milutin Kristofic 2016-12-12 13:06:15 UTC
As I understood from user comments the intention is 

when you have source code following:
.....public static void main(String[] args) {
.........System.out.println("Hello World!");|

and you press enter. you should see
.....public static void main(String[] args) {
.........System.out.println("Hello World!");
|

and not
.....public static void main(String[] args) {
.........System.out.println("Hello World!");
.........|

This behavior is not working in java as well in html. Reformating works same in Java and HTML there are no indents when Number of Spaces per Indent is 0.

I am sending back to editor indentation to evaluate this.
Comment 14 Dusan Balek 2017-05-11 09:06:03 UTC
Fixed in jet-main. Option added to switch off indentation.

http://hg.netbeans.org/jet-main/rev/b9acb7b17f7e
Comment 15 Quality Engineering 2017-05-12 01:45:30 UTC
Integrated into 'main-silver', will be available in build *201705120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b9acb7b17f7e
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #231879 - Unable to disable all automatic indentation and random carriage returns across the editor - fixed.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo