commit 443ca6b89d24c20f505afe2357ed311bae13b638
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Aug 8 16:58:29 2025 +0200

    Fix old bug in lyx_2_1.py
---
 lib/lyx2lyx/lyx_2_1.py | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py
index e17d784b99..56780f96b5 100644
--- a/lib/lyx2lyx/lyx_2_1.py
+++ b/lib/lyx2lyx/lyx_2_1.py
@@ -1116,21 +1116,26 @@ def revert_verbatim(document, starred=False):
         if k != j + 2 and consecutive == True:
             document.body[j : j + 1] = subst_end
             # the next paragraph must not be indented
-            # FIXME This seems to be causing problems, because of the
-            # hardcoded use of 19. We should figure out exactly where
-            # this needs to go by searching for the right tag.
-            document.body[j + 19 : j + 19] = ["\\noindent"]
+            k = find_token(document.body, "end{%s}" % (latex_name), j)
+            if k != -1:
+                k += 6
+                k = find_token(document.body, "\\begin_layout", k)
+                if k != -1 and not document.body[k].startswith("\\begin_layout 
Verbatim"):
+                    document.body[k + 1 : k + 1] = ["\\noindent"]
             del document.body[i : i + 1]
             consecutive = False
             continue
         else:
             document.body[j : j + 1] = subst_end
             # the next paragraph must not be indented
-            # FIXME This seems to be causing problems, because of the
-            # hardcoded use of 19. We should figure out exactly where
-            # this needs to go by searching for the right tag.
-            document.body[j + 19 : j + 19] = ["\\noindent"]
             document.body[i : i + 1] = subst_begin
+            k = find_token(document.body, "end{%s}" % (latex_name), i)
+            if k != -1:
+                k += 6
+                k = find_token(document.body, "\\begin_layout", k)
+                if k == -1 or document.body[k].startswith("\\begin_layout 
Verbatim"):
+                    continue
+                document.body[k + 1 : k + 1] = ["\\noindent"]
 
 
 def revert_tipa(document):
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to