QScintilla/Editor.py

changeset 5935
1fac1b80b440
parent 5932
af9aa23e12ec
child 5949
22657f04f332
child 5967
da72832f7c22
--- a/QScintilla/Editor.py	Thu Oct 26 19:25:37 2017 +0200
+++ b/QScintilla/Editor.py	Thu Oct 26 21:25:14 2017 +0200
@@ -4725,28 +4725,34 @@
         @param acText text to be completed
         @type str
         """
-        if acText == self.__acText and bool(completions):
-            # process the list only, if not already obsolete or completions
-            # are not empty
-            self.__acCompletions.update(set(completions))
+        # process the list only, if not already obsolete ...
+        if acText != self.__acText:
+           return
+        
+        self.__acCompletions.update(set(completions))
+        
+        self.__acCompletionsFinished += 1
+        # Got all results from auto completer?
+        if self.__acCompletionsFinished >= len(
+                self.__completionListAsyncHookFunctions):
+            self.__acWatchdog.stop()
             
-            self.__acCompletionsFinished += 1
-            # Got all results from auto completer?
-            if self.__acCompletionsFinished >= len(
-                    self.__completionListAsyncHookFunctions):
-                self.__acWatchdog.stop()
-                
-                # Autocomplete with QScintilla if no results present
-                if (Preferences.getEditor("AutoCompletionScintillaOnFail")
-                        and not self.__acCompletions):
-                    self.autoCompleteQScintilla()
-                    return
-            if self.isListActive():
-                self.cancelList()
-            
-            if self.__acCompletions:
-                self.__acCache.add(acText, set(self.__acCompletions))
-                self.__showCompletionsList(self.__acCompletions)
+            # Autocomplete with QScintilla if no results present
+            if (Preferences.getEditor("AutoCompletionScintillaOnFail")
+                    and not self.__acCompletions):
+                self.autoCompleteQScintilla()
+                return
+        
+        # ... or completions are not empty
+        if not bool(completions):
+            return
+        
+        if self.isListActive():
+            self.cancelList()
+        
+        if self.__acCompletions:
+            self.__acCache.add(acText, set(self.__acCompletions))
+            self.__showCompletionsList(self.__acCompletions)
     
     def __showCompletionsList(self, completions):
         """

eric ide

mercurial