Proposed addition for issue #1386

This commit is contained in:
adam 2016-04-27 16:47:36 -04:00
parent 0a76a7584d
commit 8fd371d836

View File

@ -172,6 +172,20 @@ class CommandRunner(QObject):
return self.parse(new_cmd, aliases=False, fallback=fallback, return self.parse(new_cmd, aliases=False, fallback=fallback,
keep=keep) keep=keep)
try: try:
""" If the command given has only one completion match, replace
the given command with the match.
Ex: If they type "bac" and the only completion is "back",
turn the command into "back".
"""
matches = []
for valid_command in cmdutils.cmd_dict.keys():
if valid_command.find(cmdstr) == 0:
matches.append(valid_command)
if len(matches) == 1:
cmdstr = matches[0]
cmd = cmdutils.cmd_dict[cmdstr] cmd = cmdutils.cmd_dict[cmdstr]
except KeyError: except KeyError:
if fallback: if fallback: