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.
If you are reading from a File that is either empty or has a single line of text (with no line separator), org.netbeans.editor.LineSeparatorConversion will return a default of '\n' regardless of platform. It should return the platform-specific line separator (Analyzer.getPlatformLS()). This causes a bug in our product when a user creates a blank file, types new text into it, and then saves. The file will always have '\n' line separators. Here is the change I made in LineSeparatorConversion's getInitialSeparator method: default: // CLA changed default to be platform-specific default // separator = "\n"; // default // NOI18N separator = (String)Analyzer.getPlatformLS(); break; } This method is called as part of Analyzer's initialRead and overwrites the previously set (correct) default line separator value: if (testLS) { doc.putProperty(BaseDocument.READ_LINE_SEPARATOR_PROP, ((LineSeparatorConversion.InitialSeparatorReader)reader).getInitialSeparator());
Should be easy to fix.
fixed in /cvs/editor/libsrc/org/netbeans/editor/LineSeparatorConversion.java new revision: 1.7; previous revision: 1.6