Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07b1407

Browse files
committed
Patches #1530
1 parent bc215d1 commit 07b1407

1 file changed

Lines changed: 23 additions & 19 deletions

File tree

lib/core/shell.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import atexit
99
import os
10-
import rlcompleter
1110

1211
from lib.core import readlineng as readline
1312
from lib.core.data import logger
@@ -16,6 +15,29 @@
1615
from lib.core.enums import OS
1716
from 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+
1941
def 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-
9599
def autoCompletion(completion=None, os=None, commands=None):
96100
if not readlineAvailable():
97101
return

0 commit comments

Comments
 (0)