* lyx_2_0.py (revert_hspace_glue_lengths):

- proceed after non-glue hspace.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30739 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-07-21 17:48:03 +00:00
parent 9a594992d2
commit 8d898ad5b7

View File

@ -1022,7 +1022,7 @@ def revert_percent_hspace_lengths(document):
if i == -1:
break
star = (document.body[i].find("\\hspace*{}") != -1)
# only revert if a custom length was set and when
# only revert if a custom length was set and if
# it used a percent length
length = get_value(document.body, '\\length', i+1)
if length == '':
@ -1057,18 +1057,17 @@ def revert_hspace_glue_lengths(document):
return
# only revert if the length contains a plus or minus at pos != 0
glue = re.compile(r'.+[\+-]')
if glue.search(length) == None:
break
# handle percent lengths
length = latex_length(length)
# latex_length returns "bool,length"
length = length.split(",")[1]
# revert the HSpace inset to ERT
if star == True:
subst = [put_cmd_in_ert("\\hspace*{" + length + "}")]
else:
subst = [put_cmd_in_ert("\\hspace{" + length + "}")]
document.body[i:i+3] = subst
if glue.search(length):
# handle percent lengths
length = latex_length(length)
# latex_length returns "bool,length"
length = length.split(",")[1]
# revert the HSpace inset to ERT
if star == True:
subst = [put_cmd_in_ert("\\hspace*{" + length + "}")]
else:
subst = [put_cmd_in_ert("\\hspace{" + length + "}")]
document.body[i:i+3] = subst
i = i + 2