From 76417c7326a9ad6822e0351f565000ecc950d636 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 29 May 2014 13:15:07 +0200 Subject: [PATCH] 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) --- lib/lyx2lyx/LyX.py | 3 +++ status.21x | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 7b534fe87a..5d8a052494 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 fd736226c0..a6a27aaa42 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 -- 2.39.5