On 2019-01-14, Scott Kostyshak wrote:

> [-- Type: text/plain, Encoding: quoted-printable --]

> On Sun, Feb 04, 2018 at 01:02:56PM +0100, Günter Milde wrote:
>> commit 2b451f01f50cf4f69200f2cd5ec646b1917156c1
>> Author: Günter Milde <mi...@lyx.org>
>> Date:   Sun Feb 4 10:16:54 2018 +0100

>>     Add newlines around \backslash in put_cmd_in_ert.

>>     Fix for 2fce4d49ee.
>> ---
>>  lib/lyx2lyx/lyx2lyx_tools.py      |    2 +-
>>  lib/lyx2lyx/test_lyx2lyx_tools.py |   23 +++++++++++++----------
>>  2 files changed, 14 insertions(+), 11 deletions(-)

> This commit caused a regression:

>   $ lyx -e lyx16x lib/examples/modernCV.lyx && lyx bisect -e lyx16x 
> lib/examples/modernCV.16.lyx

>   Text.cpp (1876): Handling unknown body token: `\begin_inset'
>   Text.cpp (1876): Handling unknown body token: `ERT'
>   Text.cpp (1876): Handling unknown body token: `status collapsed'
>   Paragraph ended in line 405
>   Missing \end_layout.
>   Error: Document format failure
>   ----------------------------------------
>   /tmp/lyx_tmpdir.pILgoDU12807/Buffer_convertLyXFormatB12807.lyx ended 
> unexpectedly, which means that it is probably corrupted.
>   LyX failed to load the following file: 
> /home/scott/lyxbuilds/bisect/repo/lib/examples/modernCV.16.lyx

I found the reason: an "\end_inset" that moved behind the next \begin_inset.

Could you try the patch below?

It solves a minimal example contrieved out of modernCV but may have
adverse side effects on other tests.

Thanks,

Günter


Exec: git 'diff' 'lyx2lyx_tools.py' 2>&1
Dir: /usr/local/src/lyx/lib/lyx2lyx/

diff --git a/lib/lyx2lyx/lyx2lyx_tools.py b/lib/lyx2lyx/lyx2lyx_tools.py
index f8d30cd470..684599f6d8 100644
--- a/lib/lyx2lyx/lyx2lyx_tools.py
+++ b/lib/lyx2lyx/lyx2lyx_tools.py
@@ -154,7 +154,7 @@ def put_cmd_in_ert(cmd):
     else:
         cmd = u"%s" % cmd # ensure it is an unicode instance
     cmd = cmd.translate(licr_table)
-    cmd = cmd.replace("\\", "\n\\backslash\n")
+    cmd = cmd.replace("\\", "\n\\backslash ")
     ret += cmd.splitlines()
     ret += ["\\end_layout", "", "\\end_inset"]
     return ret

Reply via email to