Bug 11701 fixed: Under Windows a CR was added in SciNotes each time the file is saved 13/8613/2
Calixte DENIZET [Wed, 8 Aug 2012 08:36:14 +0000 (10:36 +0200)]
Change-Id: Iff9a685d8a4b397ef095f5987ea905b3627b673c

scilab/CHANGES_5.4.X
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/ScilabDocument.java

index ce18c64..fecc4b9 100644 (file)
@@ -82,6 +82,10 @@ Bug Fixes
 
 * Bugs #11666, #11667 and #11670 to 11676 fixed - Add examples in the signal processing help pages. 
 
+* Bug #11701 fixed - Under Windows a CR was added in SciNotes each time the file
+                     is saved.
+
+
             Changes between version 5.4.0-beta-1 and 5.4.0-beta-2 of Scilab
             ===============================================================
 
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);
                 }