summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd2.py b/cmd2.py
index 6d42b730..aa851344 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -790,7 +790,9 @@ def _complete_from_cmd(cmd_obj, text, line, begidx, endidx):
command_subcommand_params = line.split(None, 3)
if len(command_subcommand_params) < (3 if text else 2):
- return cmd_obj.completenames(text)
+ n = len(command_subcommand_params[0])
+ n += sum(1 for _ in takewhile(str.isspace, line[n:]))
+ return cmd_obj.completenames(text, line[n:], begidx - n, endidx - n)
command, subcommand = command_subcommand_params[:2]
n = len(command) + sum(1 for _ in takewhile(str.isspace, line))