[LyX/master] Consider cell language

Juergen Spitzmueller spitz at lyx.org
Thu Jan 28 08:23:31 UTC 2021


commit ab1d418f36edcae906e6071cea6a54cdae88c9f2
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Jan 28 09:25:20 2021 +0100

    Consider cell language
---
 lib/lyx2lyx/lyx_2_4.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index 104ca00..f1c06ca 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -4222,7 +4222,17 @@ def revert_vcolumns2(document):
                                 if el != -1:
                                     extralines.append("\\strikeout default")
                                 document.body[elt:elt+1] = extralines + put_cmd_in_ert("\\end{cellvarwidth}") + ["\end_layout"]
-                                document.body[flt+1:flt+1] = put_cmd_in_ert("\\begin{cellvarwidth}" + alarg)
+                                parlang = -1
+                                for q in range(flt, elt):
+                                    if document.body[q] != "" and document.body[q][0] != "\\":
+                                        break
+                                    if document.body[q][:5] == "\\lang":
+                                        parlang = q
+                                        break
+                                if parlang != -1:
+                                    document.body[parlang+1:parlang+1] = put_cmd_in_ert("\\begin{cellvarwidth}" + alarg)
+                                else:
+                                    document.body[flt+1:flt+1] = put_cmd_in_ert("\\begin{cellvarwidth}" + alarg)
                                 needcellvarwidth = True
                                 needvarwidth = True
                         # ERT newlines and linebreaks (since LyX < 2.4 automatically inserts parboxes


More information about the lyx-cvs mailing list