Bug 72515 - Allow to control line separators (line endings, eol)
Allow to control line separators (line endings, eol)
Status: NEW
Product: editor
Classification: Unclassified
Component: Formatting & Indentation
6.x
All All
: P2 with 102 votes (vote)
: TBD
Assigned To: Dusan Balek
issues@editor
:
: 35233 73044 113928 132679 151262 152688 159124 166887 169651 179700 185973 194897 (view as bug list)
Depends on:
Blocks: 143309
  Show dependency treegraph
 
Reported: 2006-02-10 11:31 UTC by Miloslav Metelka
Modified: 2014-03-25 11:12 UTC (History)
18 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miloslav Metelka 2006-02-10 11:31:52 UTC
User should be able to override the line separator type (CR for Mac, LF for Unix
or CRLF for Windows) - e.g. through a menu item under Edit menu that would
display the present value and allow to change it through a set of radio buttons
in a submenu:

| Line Separator +-----------+
                 | o Windows |  (one of the radio buttons would be checked)
                 | o Unix    |
                 | o Mac     |
                 +-----------+

On the implementation level it would only be necessary to change
BaseDocument.READ_LINE_SEPARATOR_PROP appropriately and mark the document as
modified so that it gets saved.
Comment 1 Vitezslav Stejskal 2008-09-23 11:45:05 UTC
There have been usecases requesting this for both newly created files and existing files opened in the editor. Also,
please see all the duplicates. As a workaround it should be possible to use '-J-Dline.separator=' property and set it to
the appropriate EOL character(s). This will affect the whole IDE and not only the editor. Please remember that even with
line.separator property set the IDE is still going to use a line separator detected in existing files when they are open
in the editor. 
Comment 2 Vitezslav Stejskal 2008-09-23 11:45:42 UTC
*** Issue 132679 has been marked as a duplicate of this issue. ***
Comment 3 Vitezslav Stejskal 2008-09-23 11:46:08 UTC
*** Issue 35233 has been marked as a duplicate of this issue. ***
Comment 4 Vitezslav Stejskal 2008-09-23 11:46:22 UTC
*** Issue 73044 has been marked as a duplicate of this issue. ***
Comment 5 Vitezslav Stejskal 2008-09-23 11:46:35 UTC
*** Issue 113928 has been marked as a duplicate of this issue. ***
Comment 6 Vitezslav Stejskal 2008-09-23 11:48:46 UTC
*** Issue 113928 has been marked as a duplicate of this issue. ***
Comment 7 Petr Dvorak 2008-10-25 18:42:48 UTC
*** Issue 151262 has been marked as a duplicate of this issue. ***
Comment 8 Karthikeyan Rajeswaran 2008-11-12 22:29:51 UTC
nbusers forum threads on this issue: http://wiki.netbeans.org/ForumThreadsOn72515
Comment 9 Vitezslav Stejskal 2009-03-26 16:39:10 UTC
*** Issue 152688 has been marked as a duplicate of this issue. ***
Comment 10 Vitezslav Stejskal 2009-03-26 16:40:13 UTC
*** Issue 159124 has been marked as a duplicate of this issue. ***
Comment 11 Vitezslav Stejskal 2009-03-26 16:42:27 UTC
Issue #159124 points out that:

Netbeans handles line endings differently depending on how a new file is created.

(Using Windows Xp sp3)
- Create a PHP file by File->New File...-> PHP File and the resulting file has Unix line endings.
- Create a blank file and it has Windows line endings.
Comment 12 Tomas Mysik 2009-06-11 09:21:02 UTC
*** Issue 166887 has been marked as a duplicate of this issue. ***
Comment 13 Vitezslav Stejskal 2010-01-20 05:43:13 UTC
*** Bug 169651 has been marked as a duplicate of this bug. ***
Comment 14 Vitezslav Stejskal 2010-01-20 05:43:31 UTC
*** Bug 179700 has been marked as a duplicate of this bug. ***
Comment 15 knitter 2010-01-26 05:14:00 UTC
Changing line endings is a very common feature, and given the examples in the PHP module's list and the requests from users, one that could be useful to have in the IDE.

I believe the feature would be simple to implement and would be useful to the users.
Comment 16 _ moser 2010-01-26 06:57:05 UTC
Certainly NetBeans is more than an editor, but however, essentially it is a comfortable editor. And for an editor it is a key feature to allow a user to control a file's line endings. So it's astounding (for me) that NB came up to version 6.8 without that feature.
Comment 17 Vitezslav Stejskal 2010-05-12 12:23:22 UTC
*** Bug 185973 has been marked as a duplicate of this bug. ***
Comment 18 postmoderncore 2010-07-17 23:57:43 UTC
I consider this an obvious feature for a cross platform development IDE. Whilst, as others have pointed out, version control systems will take care of line endings, this doesn't cover all scenarios.
Comment 19 nbphpuser 2010-07-18 08:36:19 UTC
-J-Dline.separator=

Does this switch work? If so, how to use it forcing UNIX line endings under windows?
Comment 20 PyKaB 2010-07-21 08:08:27 UTC
it would be logical to implement like this:

right click on project -> Properties -> Source: Encoding, EOL char
Comment 21 David Strupl 2011-02-28 16:29:06 UTC
*** Bug 194897 has been marked as a duplicate of this bug. ***
Comment 22 dio5 2011-03-01 08:43:22 UTC
I think ideally it should do something like editpad pro or the like:

display the current line ending format on the bottom of the page for example 'windows'. Clicking it shows a dropdown to convert it to one of the others like unix or mac.

I spent hours on a project which wasn't under version control and needed to upload through ftp which threw the most weird errors ever. Turned out some files had mac line endings which got screwed up through ftp (still haven't figured out what went wrong, it worked locally on windows & unix.)

All the line endings misery could be so easily solved if it would just display the currently used line endings somewhere in a status bar and would have the ability to convert it.

I'm amazed that such a great editor like Netbeans doesn't have this option.
Comment 23 dio5 2011-03-01 08:46:44 UTC
Oh yes, seeing this has been reported since 2006... What are you waiting for?
Comment 24 Jan Lahoda 2011-03-09 13:00:19 UTC
A plugin that shows the line endings of the currently edited file and allows to change them:
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=36810
Comment 25 iotriado 2011-03-10 07:26:13 UTC
Your plugin is ideal for this issue. Thank you
Comment 26 dio5 2011-03-23 21:04:02 UTC
Perfect, plugin is exactly what's needed.
Comment 27 Alexander Pepin 2011-04-26 14:08:16 UTC
*** Bug 198072 has been marked as a duplicate of this bug. ***
Comment 28 monk.e.boy 2011-09-21 09:08:15 UTC
Hi, just to remind everyone that I'm still getting bitten by this issue :) had some mysterious errors when running a .php file from cron, turns out the file had been created using NetBeans and had Win EOLs in it :(

  Extension '/home/xxxxxxxx/do_things.php' not present.
Comment 29 Jeffrey Rubinoff 2011-09-21 09:29:57 UTC
(In reply to comment #28)
> Hi, just to remind everyone that I'm still getting bitten by this issue :) had
> some mysterious errors when running a .php file from cron, turns out the file
> had been created using NetBeans and had Win EOLs in it :(
> 
>   Extension '/home/xxxxxxxx/do_things.php' not present.

Have you tried the plugin?
Comment 30 terje7601 2012-07-06 18:04:07 UTC
Please add the plugin to the NetBeans core. It works great & this is essential functionality.

Imho, other things that should be added are:
1) setting the EOL on a global level in Options (-> Editor -> Formatting seems like a logical place to me)
2) setting the EOL on a per-project basis (under Formatting again)
3) a way to change the EOL of selected resources, analog to the new Source -> Format functionality to format not just files, but whole folders & projects. This would be needed because the EOL settings should only be applied to newly created files. Pre-existing files, or files that are imported from outside the editor (by drag-and-drop for example) should not be converted automatically, even when editing & saving them.
Comment 31 stefanocrosta 2013-03-22 18:56:11 UTC
I totally agree with terje7601@netbeans.org

This ticket should probably be updated to apply to 7.x ?
Comment 32 katsuke 2013-05-26 01:03:24 UTC
Bump. Pushed requested version to the next version of netbeans since 7.3.1 i think wont be able to deliver this.
Comment 33 markiewb 2013-05-26 08:14:30 UTC
(In reply to comment #32)
> Bump. Pushed requested version to the next version of netbeans since 7.3.1 i
> think wont be able to deliver this.
To do this you should have changed the target version not the reported version. BUT changing the target version to 7.4 won't make any NB dev to start working on this issue. 

Have you tried the plugin?

PS: I changed the reported version back to 6.x
Comment 34 terje7601 2013-08-22 10:40:32 UTC
This functionality should also be made to work correctly with Templates: currently, when doing e.g. "New -> PHP Class...", the file contains the EOL of the template. In the future, the file should contain the EOL that is specified for the project.
Comment 35 Deebster 2014-03-25 11:12:18 UTC
I was surprised and disappointed that changing the line endings in the template had no effect on the line endings of created files. This fix would go some way towards fixing that.


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