Sun, 01 Aug 2010 13:08:23 +0200
Fixed a few unicode related issues.
AssistantEric/Assistant.py | file | annotate | diff | comparison | revisions | |
ChangeLog | file | annotate | diff | comparison | revisions | |
PluginAssistantEric.zip | file | annotate | diff | comparison | revisions |
diff -r 8f33c2f5bfbd -r b8ece0b784e8 AssistantEric/Assistant.py --- a/AssistantEric/Assistant.py Fri Jul 30 18:53:11 2010 +0200 +++ b/AssistantEric/Assistant.py Sun Aug 01 13:08:23 2010 +0200 @@ -8,6 +8,8 @@ calltips system. """ +import re + from PyQt4.QtCore import * from E5Gui.E5Application import e5App @@ -256,7 +258,7 @@ projectCompletionList = [] sep = "" if context: - wc = editor.wordCharacters() + wc = re.sub("\w", "", editor.wordCharacters()) text = editor.text(line) beg = text[:col] @@ -266,7 +268,9 @@ break depth = 0 - while col > 0 and text[col - 1] not in wc: + while col > 0 and \ + (not text[col - 1].isalnum() or \ + (wc and text[col - 1] not in wc)): ch = text[col - 1] if ch == ')': depth = 1 @@ -377,7 +381,12 @@ if context: word += sep - res = editor.findFirstTarget(word, False, editor.autoCompletionCaseSensitivity(), + if editor.isUtf8(): + sword = word.encode("utf-8") + else: + sword = word + res = editor.findFirstTarget(sword, False, + editor.autoCompletionCaseSensitivity(), False, begline = 0, begindex = 0, ws_ = True) while res: start, length = editor.getFoundTarget() @@ -387,11 +396,9 @@ completion = "" else: completion = word - ch = editor.charAt(pos) - while editor.isWordCharacter(ch): - completion += ch - pos += 1 - ch = editor.charAt(pos) + line, index = editor.lineIndexFromPosition(pos) + curWord = editor.getWord(line, index, useWordChars = False) + completion += curWord[len(completion):] if completion and completion not in completionsList: completionsList.append( "{0}?{1}".format(completion, self.__fromDocumentID)) @@ -435,9 +442,11 @@ return line, col = editor.lineIndexFromPosition(pos) - wc = editor.wordCharacters() + wc = re.sub("\w", "", editor.wordCharacters()) text = editor.text(line) - while col > 0 and text[col - 1] not in wc: + while col > 0 and \ + (not text[col - 1].isalnum() or \ + (wc and text[col - 1] not in wc)): col -= 1 word = editor.getWordLeft(line, col)