Bug 123287

Summary: [misc] convert line delimiters on save
Product: [Eclipse Project] Platform Reporter: Amy Wu <for.work.things>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: eostroukhov
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 195063    
Bug Blocks:    

Description Amy Wu CLA 2006-01-10 13:27:39 EST
It would be nice if there was an option to convert line delimiters when a file is saved.  For example, what happens now if user inserts a template that spans multiple lines?  Are the line delimiters automatically converted to whatever the user specified in the preference?  Or what if line delimiters are inserted programatically elsewhere?  There is no guarantee that the preferred line delimiter will be used.
Comment 1 Dani Megert CLA 2006-01-11 11:07:20 EST
Such an option would make sense. See also bug 6749, bug 22742 and bug 41320.

>Are the line delimiters automatically converted to whatever
>the user specified in the preference?
No, there's no auto-conversion since an IDocument can handle mixed line delimiters and it's speced that clients decided whether to honour this:
 * An <code>IDocument</code> does not care about mixed line delimiters. Clients who
 * want to ensure a single line delimiter in their document should use the line
 * delimiter returned by {@link org.eclipse.jface.text.TextUtilities#getDefaultLineDelimiter(IDocument)}.

>Or what if line delimiters are inserted
>programatically elsewhere? There is no guarantee that the preferred line
>delimiter will be used.
Yes, as outlined above (Javadoc of IDocument) it's up to the programmer to decide whether to use the document's default line delimiter or not. Of course we or clients could create a document that enforces modifications to only contain the default line delimiter but this limitation is not required from a text framework point of view.
Comment 2 Dani Megert CLA 2006-10-26 12:26:16 EDT
We could add a clean up but that would only work for Java files.
Comment 3 Eclipse Webmaster CLA 2019-09-06 16:11:31 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.