File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88import atexit
99import os
10- import rlcompleter
1110
1211from lib .core import readlineng as readline
1312from lib .core .data import logger
1615from lib .core .enums import OS
1716from lib .core .settings import MAX_HISTORY_LENGTH
1817
18+ try :
19+ import rlcompleter
20+
21+ class CompleterNG (rlcompleter .Completer ):
22+ def global_matches (self , text ):
23+ """
24+ Compute matches when text is a simple name.
25+ Return a list of all names currently defined in self.namespace
26+ that match.
27+ """
28+
29+ matches = []
30+ n = len (text )
31+
32+ for ns in (self .namespace ,):
33+ for word in ns :
34+ if word [:n ] == text :
35+ matches .append (word )
36+
37+ return matches
38+ except :
39+ readline ._readline = None
40+
1941def readlineAvailable ():
2042 """
2143 Check if the readline is available. By default
@@ -74,24 +96,6 @@ def loadHistory(completion=None):
7496 warnMsg = "there was a problem loading the history file '%s' (%s)" % (historyPath , msg )
7597 logger .warn (warnMsg )
7698
77- class CompleterNG (rlcompleter .Completer ):
78- def global_matches (self , text ):
79- """
80- Compute matches when text is a simple name.
81- Return a list of all names currently defined in self.namespace
82- that match.
83- """
84-
85- matches = []
86- n = len (text )
87-
88- for ns in (self .namespace ,):
89- for word in ns :
90- if word [:n ] == text :
91- matches .append (word )
92-
93- return matches
94-
9599def autoCompletion (completion = None , os = None , commands = None ):
96100 if not readlineAvailable ():
97101 return
You can’t perform that action at this time.
0 commit comments