From 359ffdd28f60fb9acb2ea349995943de0cb58e06 Mon Sep 17 00:00:00 2001 From: lagos Date: Sat, 29 Sep 2012 00:34:52 -0700 Subject: [PATCH] Modifies cmdparser to not apply case-sensitive match filtering if it eliminate all results. --- src/commands/cmdparser.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/cmdparser.py b/src/commands/cmdparser.py index 35821a3d9d..89c55590a0 100644 --- a/src/commands/cmdparser.py +++ b/src/commands/cmdparser.py @@ -73,8 +73,11 @@ def cmdparser(raw_string, cmdset, caller, match_index=None): matches = [match for match in matches if match[2].access(caller, 'cmd')] if len(matches) > 1: - # see if it helps to analyze the match with preserved case. - matches = [match for match in matches if raw_string.startswith(match[0])] + # See if it helps to analyze the match with preserved case but only if + # it leaves at least one match. + trimmed = [match for match in matches if raw_string.startswith(match[0])] + if trimmed: + matches = trimmed if len(matches) > 1: # we still have multiple matches. Sort them by count quality.