Don't rely upon there being a certain number of argumnets to the box inset.

Some later LyX version might omit defaults without lyx2lyx to replace them.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34787 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-07-06 14:50:59 +00:00
parent 673e65cc15
commit 1a3629d720

View File

@ -1830,9 +1830,13 @@ def revert_makebox(document):
return
j = find_token(document.body, 'use_makebox 1', i)
# assure we found the makebox of the current box
if j > i + 7 or j == -1:
if j > z or j == -1:
return
# remove the \end_inset
y = find_token(document.body, "\\begin_layout", i)
if y > z or y == -1:
document.warning("Malformed LyX document: Can't find layout in box.")
return
# remove the \end_layout \end_inset pair
document.body[z - 2:z + 1] = put_cmd_in_ert("}")
# determine the alignment
k = find_token(document.body, 'hor_pos', j - 4)
@ -1846,7 +1850,7 @@ def revert_makebox(document):
length = latex_length(length).split(",")[1]
subst = "\\makebox[" + length + "][" \
+ align + "]{"
document.body[i:i + 14] = put_cmd_in_ert(subst)
document.body[i:y+1] = put_cmd_in_ert(subst)
i += 1