Fixed a few unicode related issues.

Sun, 01 Aug 2010 13:08:23 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 01 Aug 2010 13:08:23 +0200
changeset 18
b8ece0b784e8
parent 17
8f33c2f5bfbd
child 19
7eb775bb326b

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
--- 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)
         
--- a/ChangeLog	Fri Jul 30 18:53:11 2010 +0200
+++ b/ChangeLog	Sun Aug 01 13:08:23 2010 +0200
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 2.0.1:
+- bug fixes
+
 Version 2.0.0:
 - added Italian translations
 
Binary file PluginAssistantEric.zip has changed

eric ide

mercurial