Always use shortest match for completion.use_best_match

This commit is contained in:
Florian Bruhin 2017-10-17 15:01:37 +02:00
parent 4984c9d05c
commit 12c9590524

View File

@ -214,7 +214,8 @@ class CommandParser:
Return: Return:
cmdstr modified to the matching completion or unmodified cmdstr modified to the matching completion or unmodified
""" """
matches = [cmd for cmd in cmdutils.cmd_dict if cmdstr in cmd] matches = [cmd for cmd in sorted(cmdutils.cmd_dict, key=len)
if cmdstr in cmd]
if len(matches) == 1: if len(matches) == 1:
cmdstr = matches[0] cmdstr = matches[0]
elif len(matches) > 1 and config.val.completion.use_best_match: elif len(matches) > 1 and config.val.completion.use_best_match: