Fix bug reported by Martin.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5385 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-10-11 18:08:21 +00:00
parent e1a68ef733
commit 36afcb3f8e
2 changed files with 8 additions and 4 deletions

View File

@ -213,10 +213,12 @@ def remove_oldert(lines):
break break
j = i+1 j = i+1
while 1: while 1:
j = find_tokens(lines, ["\\latex default", "\\begin_inset", "\\layout", "\\end_inset", "\\end_float", "\\the_end"], # \end_inset is for ert inside a tabular cell. The other tokens
# are obvious.
j = find_tokens(lines, ["\\latex default", "\\layout", "\\begin_inset", "\\end_inset", "\\end_float", "\\the_end"],
j) j)
if check_token(lines[j], "\\begin_inset"): if check_token(lines[j], "\\begin_inset"):
j = find_end_of_inset(lines, j) j = find_end_of_inset(lines, j)+1
else: else:
break break

View File

@ -92,16 +92,18 @@ def del_token(lines, token, i, j):
# Finds the paragraph that contains line i. # Finds the paragraph that contains line i.
def get_paragraph(lines, i): def get_paragraph(lines, i):
while 1: while i != -1:
i = find_tokens_backwards(lines, ["\\end_inset", "\\layout"], i) i = find_tokens_backwards(lines, ["\\end_inset", "\\layout"], i)
if i == -1: return -1
if check_token(lines[i], "\\layout"): if check_token(lines[i], "\\layout"):
return i return i
i = find_beginning_of_inset(lines, i) i = find_beginning_of_inset(lines, i)
# Finds the paragraph after the paragraph that contains line i. # Finds the paragraph after the paragraph that contains line i.
def get_next_paragraph(lines, i): def get_next_paragraph(lines, i):
while 1: while i != -1:
i = find_tokens(lines, ["\\begin_inset", "\\layout"], i) i = find_tokens(lines, ["\\begin_inset", "\\layout"], i)
if i == -1: return -1
if check_token(lines[i], "\\layout"): if check_token(lines[i], "\\layout"):
return i return i
i = find_end_of_inset(lines, i) i = find_end_of_inset(lines, i)