QScintilla/Editor.py

changeset 5935
1fac1b80b440
parent 5932
af9aa23e12ec
child 5949
22657f04f332
child 5967
da72832f7c22
equal deleted inserted replaced
5934:0fe4ff083281 5935:1fac1b80b440
4723 @param completions list of possible completions 4723 @param completions list of possible completions
4724 @type list of str or set of str 4724 @type list of str or set of str
4725 @param acText text to be completed 4725 @param acText text to be completed
4726 @type str 4726 @type str
4727 """ 4727 """
4728 if acText == self.__acText and bool(completions): 4728 # process the list only, if not already obsolete ...
4729 # process the list only, if not already obsolete or completions 4729 if acText != self.__acText:
4730 # are not empty 4730 return
4731 self.__acCompletions.update(set(completions)) 4731
4732 self.__acCompletions.update(set(completions))
4733
4734 self.__acCompletionsFinished += 1
4735 # Got all results from auto completer?
4736 if self.__acCompletionsFinished >= len(
4737 self.__completionListAsyncHookFunctions):
4738 self.__acWatchdog.stop()
4732 4739
4733 self.__acCompletionsFinished += 1 4740 # Autocomplete with QScintilla if no results present
4734 # Got all results from auto completer? 4741 if (Preferences.getEditor("AutoCompletionScintillaOnFail")
4735 if self.__acCompletionsFinished >= len( 4742 and not self.__acCompletions):
4736 self.__completionListAsyncHookFunctions): 4743 self.autoCompleteQScintilla()
4737 self.__acWatchdog.stop() 4744 return
4738 4745
4739 # Autocomplete with QScintilla if no results present 4746 # ... or completions are not empty
4740 if (Preferences.getEditor("AutoCompletionScintillaOnFail") 4747 if not bool(completions):
4741 and not self.__acCompletions): 4748 return
4742 self.autoCompleteQScintilla() 4749
4743 return 4750 if self.isListActive():
4744 if self.isListActive(): 4751 self.cancelList()
4745 self.cancelList() 4752
4746 4753 if self.__acCompletions:
4747 if self.__acCompletions: 4754 self.__acCache.add(acText, set(self.__acCompletions))
4748 self.__acCache.add(acText, set(self.__acCompletions)) 4755 self.__showCompletionsList(self.__acCompletions)
4749 self.__showCompletionsList(self.__acCompletions)
4750 4756
4751 def __showCompletionsList(self, completions): 4757 def __showCompletionsList(self, completions):
4752 """ 4758 """
4753 Private method to show the completions list. 4759 Private method to show the completions list.
4754 4760

eric ide

mercurial