cliff/cliff
Brano Zarnovican b8e7a78a45 fix fuzzy search for same-distance case
get_fuzzy_matches() cannot handle case where all
commands have the same Levenshtein distance
from searched command. It will bomb-out with
IndexError (dist[i][1] referencing one element
after the end).

It also does not handle no-commands case or
the case where searched command is the prefix of
all commands. The latter two cases are minor, since
'help' and 'complete' commands are always present.

We fix it by iterating over the partial result
safely, consuming only candidates with distance==0
(prefix commands) and those of the same minimum
distance.

Closes-Bug: #1500445
Change-Id: Iae5e77b64dc0d96e040acdcadf019db66a416648
2015-11-12 16:53:56 +01:00
..
formatters only use unicodecsv for python 2.x 2015-09-23 21:33:56 +00:00
tests fix fuzzy search for same-distance case 2015-11-12 16:53:56 +01:00
__init__.py add setup.py and package directory 2012-04-20 09:52:55 -07:00
app.py fix fuzzy search for same-distance case 2015-11-12 16:53:56 +01:00
command.py Pass user command text to the Command object 2015-03-06 12:28:04 -06:00
commandmanager.py Do not check requirements when loading plugins 2015-04-22 00:58:45 +00:00
complete.py use entry points for completion plugins 2013-11-12 18:14:37 -05:00
display.py Pass user command text to the Command object 2015-03-06 12:28:04 -06:00
help.py Merge "Print help on help command" 2015-06-03 20:58:34 +00:00
interactive.py Merge "Correct completion in interactive mode" 2015-03-04 02:59:54 +00:00
lister.py Merge "Use six.add_metaclass instead of __metaclass__" 2014-06-09 15:11:34 +00:00
show.py Merge "Use six.add_metaclass instead of __metaclass__" 2014-06-09 15:11:34 +00:00
utils.py Add command fuzzy matching 2015-07-24 06:25:19 +00:00