Bug 11701 fixed: Under Windows a CR was added in SciNotes each time the file is saved
[scilab.git] / scilab / modules / scinotes / src / java / org / scilab / modules / scinotes / ScilabDocument.java
index cae5086..ef5dad3 100644 (file)
@@ -275,19 +275,18 @@ public class ScilabDocument extends PlainDocument implements DocumentListener {
     public void addEOL() {
         if (SciNotesOptions.getSciNotesPreferences().addLineTermination) {
             int len = getLength();
-            int lenEOL = getEOL().length();
-            if (getLength() >= lenEOL) {
+            if (getLength() >= 1) {
                 try {
-                    String end = getText(len - lenEOL, lenEOL);
-                    if (!end.equals(getEOL())) {
-                        insertString(len, getEOL(), null);
+                    String end = getText(len - 1, 1);
+                    if (!end.equals("\n")) {
+                        insertString(len, "\n", null);
                     }
                 } catch (BadLocationException e) {
                     System.err.println(e);
                 }
             } else {
                 try {
-                    insertString(len, getEOL(), null);
+                    insertString(len, "\n", null);
                 } catch (BadLocationException e) {
                     System.err.println(e);
                 }