[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/2.1.x] Do not corrupt documents without newline at EOF
From:       Richard Heck <rgheck () lyx ! org>
Date:       2014-05-29 15:28:53
Message-ID: 20140529152853.AC9262802CE () lyx ! lyx ! org
[Download RAW message or body]

commit 76417c7326a9ad6822e0351f565000ecc950d636
Author: Georg Baum <baum@lyx.org>
Date:   Thu May 29 13:15:07 2014 +0200

    Do not corrupt documents without newline at EOF
    
    trim_eol() assumes that a line always ends either with \n, \r, or \r\n.
    This assumption is always valid except for the last line of a document, since it
    may miss the trailing newline. LyX does not create such documents, bu they may
    result from automatic creation tools, and LyX can read them, so lyx2lyx should
    be able to read them as well.
    (cherry picked from commit c75c6e446a8bc0dbaabaf156c0abfd622c050129)
    
    Fix the fix
    
    MAC-style (pre-OS X) line ends were not recognized anymore
    (cherry picked from commit 55af9cb006563032e35fcc8bc5c8c1284c0344da)

diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py
index 7b534fe..5d8a052 100644
--- a/lib/lyx2lyx/LyX.py
+++ b/lib/lyx2lyx/LyX.py
@@ -145,6 +145,9 @@ def get_backend(textclass):
 
 def trim_eol(line):
     " Remove end of line char(s)."
+    if line[-1] != '\n' and line[-1] != '\r':
+        # May happen for the last line of a document
+        return line
     if line[-2:-1] == '\r':
         return line[:-2]
     else:
diff --git a/status.21x b/status.21x
index fd73622..a6a27aa 100644
--- a/status.21x
+++ b/status.21x
@@ -65,6 +65,17 @@ What's new
 - Fix problem converting layout files and modules when Flex inset names are
   quoted.
 
+- Honor the NextNoIndent layout parameter also in the exported output.
+
+- Output arguments required by arguments with DefaultArg or PresetArg (bug 9128).
+
+
+* LYX2LYX
+
+- We have fixed several significant issues involving conversion of 2.0 format 
+  into   2.1 format, and conversely. This mostly affects the new argument insets 
+  and, in particular, beamer documents. These are detailed below.
+
 - Fix conversion of beamer block titles ending with non-ERT insets to 2.1 format.
 
 - Fix conversion of beamer blocks with preceding or trailing blanks.
@@ -80,14 +91,10 @@ What's new
 
 - Fix table cell rotation conversion from 2.1 to 2.0 format.
 
-- Honor the NextNoIndent layout parameter also in the exported output.
-
 - Fix import of some argument insets.
 
 - Fix some nesting problems in reversion of some beamer environments to 2.0 format.
 
-- Output arguments required by arguments with DefaultArg or PresetArg (bug 9128).
-
 
 * USER INTERFACE
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic