From: Jürgen Spitzmüller Date: Thu, 19 Jul 2007 14:59:43 +0000 (+0000) Subject: * lib/lyx2lyx/lyx_1_5.py (revert_unicode): fixes by Georg Baum (bug 3985) X-Git-Tag: 1.6.10~9096 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f36e1b4b31e0c0162103c19ce8fc442874af2ec0;p=lyx.git * lib/lyx2lyx/lyx_1_5.py (revert_unicode): fixes by Georg Baum (bug 3985) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19138 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_1_5.py b/lib/lyx2lyx/lyx_1_5.py index 70ede06f6d..228cf92951 100644 --- a/lib/lyx2lyx/lyx_1_5.py +++ b/lib/lyx2lyx/lyx_1_5.py @@ -1043,7 +1043,8 @@ def revert_accent(document): # encoding. encoding_stack = [get_encoding(document.language, document.inputencoding, 248, document.cjk_encoding)] lang_re = re.compile(r"^\\lang\s(\S+)") - for i in range(len(document.body)): + i = 0 + while i < len(document.body): if (document.inputencoding == "auto" or document.inputencoding == "default") and document.cjk_encoding != '': # Track the encoding of the current line @@ -1075,7 +1076,7 @@ def revert_accent(document): except UnicodeEncodeError: # Insert the rest of the line as new line if j < len(document.body[i]) - 1: - document.body[i+1:i+1] = document.body[i][j+1:] + document.body.insert(i+1, document.body[i][j+1:]) # Delete the accented character if j > 0: document.body[i] = document.body[i][:j-1] @@ -1097,7 +1098,7 @@ def revert_accent(document): except UnicodeEncodeError: # Insert the rest of the line as new line if j < len(document.body[i]) - 1: - document.body[i+1:i+1] = document.body[i][j+1:] + document.body.insert(i+1, document.body[i][j+1:]) # Delete the accented characters if j > 1: document.body[i] = document.body[i][:j-2] @@ -1106,6 +1107,8 @@ def revert_accent(document): # Finally add the InsetLaTeXAccent document.body[i] += "\\i \\%s{%s}" % (inverse_accent_map[accent], accented_char) break + i = i + 1 + # Normalize to "Normal form C" (NFC, pre-composed characters) again for i in range(numberoflines): document.body[i] = unicodedata.normalize("NFC", document.body[i]) @@ -1890,7 +1893,7 @@ implemented.''' in_math = False # flag set to 1 if in math inset insets = [] # list of active insets mod_body = u'' # to store the modified document body - + # Go through the file to capture all combining characters last_char = '' # to store the previous character body_string = u'' # store the document temporarily as a string