commit dc02e307979ad34684dbea1cdc56de1ca870cd03
Author: Juergen Spitzmueller <[email protected]>
Date: Wed Apr 16 07:57:05 2025 +0200
Fix endless recursion and string detection mismatch in lyx2lyx (#13168)
---
lib/lyx2lyx/lyx2lyx_tools.py | 5 ++++-
status.24x | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/lyx2lyx/lyx2lyx_tools.py b/lib/lyx2lyx/lyx2lyx_tools.py
index 015a4b7e73..e3ab58b238 100644
--- a/lib/lyx2lyx/lyx2lyx_tools.py
+++ b/lib/lyx2lyx/lyx2lyx_tools.py
@@ -116,14 +116,17 @@ def add_to_preamble(document, text):
if i == -1:
break
# we need a perfect match
+ # ignoring surrounding whitespace, though (see #13168)
matched = True
for line in text:
- if i >= prelen or line != document.preamble[i]:
+ if i >= prelen or line.strip() != document.preamble[i].strip():
matched = False
break
i += 1
if matched:
return
+ else:
+ i += 1
document.preamble.extend(["% Added by lyx2lyx"])
document.preamble.extend(text)
diff --git a/status.24x b/status.24x
index fcc0d03c0a..30b9a46524 100644
--- a/status.24x
+++ b/status.24x
@@ -127,6 +127,8 @@ What's new
* LYX2LYX
+- Fix endless recursion and string detection mismatch in lyx2lyx
+ (bug 13168).
* TEX2LYX
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs