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.
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.
*** Issue 132679 has been marked as a duplicate of this issue. ***
*** Issue 35233 has been marked as a duplicate of this issue. ***
*** Issue 73044 has been marked as a duplicate of this issue. ***
*** Issue 113928 has been marked as a duplicate of this issue. ***
*** Issue 151262 has been marked as a duplicate of this issue. ***
nbusers forum threads on this issue: http://wiki.netbeans.org/ForumThreadsOn72515
*** Issue 152688 has been marked as a duplicate of this issue. ***
*** Issue 159124 has been marked as a duplicate of this issue. ***
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.
*** Issue 166887 has been marked as a duplicate of this issue. ***
*** Bug 169651 has been marked as a duplicate of this bug. ***
*** Bug 179700 has been marked as a duplicate of this bug. ***
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.
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.
*** Bug 185973 has been marked as a duplicate of this bug. ***
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.
Does this switch work? If so, how to use it forcing UNIX line endings under windows?
it would be logical to implement like this:
right click on project -> Properties -> Source: Encoding, EOL char
*** Bug 194897 has been marked as a duplicate of this bug. ***
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.
Oh yes, seeing this has been reported since 2006... What are you waiting for?
A plugin that shows the line endings of the currently edited file and allows to change them:
Your plugin is ideal for this issue. Thank you
Perfect, plugin is exactly what's needed.
*** Bug 198072 has been marked as a duplicate of this bug. ***
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.
(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?
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.
I totally agree with email@example.com
This ticket should probably be updated to apply to 7.x ?
Bump. Pushed requested version to the next version of netbeans since 7.3.1 i think wont be able to deliver this.
(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
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.
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.