Handle maxsplit=-1 correctly for completions

This commit is contained in:
Florian Bruhin 2014-05-01 20:18:29 +02:00
parent 48f9a1a449
commit 0bf918631e

View File

@ -175,7 +175,8 @@ class CommandManager:
self._cmd = cmd
self._args = args
retargs = args[:]
if text.endswith(' ') and len(args) <= cmd.maxsplit:
if text.endswith(' ') and (cmd.maxsplit == -1 or
len(args) <= cmd.maxsplit):
retargs.append('')
return [cmdstr] + retargs