[LyX/master] Fix revert_contextual_breaks
Juergen Spitzmueller
spitz at lyx.org
Tue Aug 4 04:32:19 UTC 2026
commit 8181d133adfe44059d5c9a3cfac1fb6a4a6b61d6
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Tue Aug 4 06:31:48 2026 +0200
Fix revert_contextual_breaks
This didn't account for all Frame types
Thanks to Pavel and Claude
---
lib/lyx2lyx/lyx_2_6.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/lyx2lyx/lyx_2_6.py b/lib/lyx2lyx/lyx_2_6.py
index 00ded52956..f88d3f011b 100644
--- a/lib/lyx2lyx/lyx_2_6.py
+++ b/lib/lyx2lyx/lyx_2_6.py
@@ -627,11 +627,21 @@ def revert_contextual_breaks(document):
handled = False
k = i - 1
while True:
- k = find_token_backwards(document.body, "\\begin_layout Frame", k)
+ kInit = k
+ poss_frame = -1
+ last_poss_frame = -1
+ # check for the nearest frame
+ for frame in ["Frame", "PlainFrame", "FragileFrame"]:
+ poss_frame = find_token_backwards(document.body, "\\begin_layout %s" % frame, kInit)
+ if poss_frame != -1:
+ if poss_frame > last_poss_frame:
+ k = poss_frame
+ last_poss_frame = poss_frame
if k == -1:
break
l = find_end_of_sequence(document.body, k)
if l > i:
+ # break is within frame (this includes nested paragraphs)
document.body[i : j + 1] = put_cmd_in_ert("\\framebreak{}")
i += 1
handled = True
More information about the lyx-cvs
mailing list