Fixed a crash bug introduced with inexact case matching
This commit is contained in:
parent
ba7e36c719
commit
3bc25d44ee
|
@ -87,9 +87,13 @@ def complete_line(line, possible_matches):
|
|||
|
||||
for match in possible_matches[1:]:
|
||||
for i, c in enumerate(match):
|
||||
try:
|
||||
if c.lower() != possible_matches[0][i].lower():
|
||||
maxlen = min(maxlen, i)
|
||||
break
|
||||
except IndexError:
|
||||
maxlen = min(maxlen, i)
|
||||
break
|
||||
|
||||
return possible_matches[0][:maxlen].replace(" ", r"\ ")
|
||||
|
||||
|
@ -597,7 +601,11 @@ class Legacy(BaseMode):
|
|||
if hits == 1:
|
||||
p = " ".join(split(line)[:-1])
|
||||
|
||||
try:
|
||||
l_arg = shlex.split(line)[-1]
|
||||
except IndexError:
|
||||
l_arg = ""
|
||||
|
||||
new_line = " ".join( [p, complete_line(l_arg, possible_matches)] ).lstrip()
|
||||
|
||||
if len(format_utils.remove_formatting(new_line)) > len(line):
|
||||
|
|
Loading…
Reference in New Issue