1
0
forked from VimPlug/jedi

REPL completion deletes the line sometimes, fixes #293

This commit is contained in:
David Halter
2013-08-16 10:00:52 +04:30
parent 8b5e130e55
commit 4b0465a2d1
2 changed files with 3 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ def setup_readline(namespace_module=__main__):
# use the "default" completion with ``getattr`` if # use the "default" completion with ``getattr`` if
# possible. # possible.
path, dot, like = interpreter._get_completion_parts() path, dot, like = interpreter._get_completion_parts()
before = text[:len(text) - len(like)]
# Shouldn't be an import statement and just a simple path # Shouldn't be an import statement and just a simple path
# with dots. # with dots.
is_import = re.match('^\s*(import|from) ', text) is_import = re.match('^\s*(import|from) ', text)
@@ -88,11 +89,10 @@ def setup_readline(namespace_module=__main__):
for n in namespaces: for n in namespaces:
for name in dir(n): for name in dir(n):
if name.lower().startswith(like.lower()): if name.lower().startswith(like.lower()):
self.matches.append(path + dot + name) self.matches.append(before + name)
else: else:
completions = interpreter.completions() completions = interpreter.completions()
before = text[:len(text) - len(like)]
self.matches = [before + c.name_with_symbols self.matches = [before + c.name_with_symbols
for c in completions] for c in completions]
try: try:

View File

@@ -1,5 +1,6 @@
""" named params: """ named params:
>>> def a(abc): pass >>> def a(abc): pass
...
>>> a(abc=3) # <- this stuff >>> a(abc=3) # <- this stuff
""" """