]> git.lyx.org Git - features.git/commitdiff
Do not corrupt documents without newline at EOF
authorGeorg Baum <baum@lyx.org>
Thu, 29 May 2014 11:15:07 +0000 (13:15 +0200)
committerRichard Heck <rgheck@lyx.org>
Thu, 29 May 2014 15:28:04 +0000 (11:28 -0400)
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)

lib/lyx2lyx/LyX.py
status.21x

index 7b534fe87a3c12284178b30d9e77907284f180c3..5d8a052494ff4f823fc8ff0f65565dd48957920f 100644 (file)
@@ -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:
index fd736226c033ee12705a6fac29e03df2a6c7393a..a6a27aaa42346fae2485671c4af1aa0dbfa43cbb 100644 (file)
@@ -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