mirror of
https://github.com/dbcli/pgcli.git
synced 2024-10-06 02:07:53 +03:00
Fix auto-completion breaking for table names with caps
This commit is contained in:
parent
289d960114
commit
f1ff7158e0
@ -223,7 +223,7 @@ class PGCompleter(Completer):
|
||||
pat = re.compile('(%s)' % regex)
|
||||
|
||||
def _match(item):
|
||||
r = pat.search(self.unescape_name(item))
|
||||
r = pat.search(self.unescape_name(item.lower()))
|
||||
if r:
|
||||
return -len(r.group()), -r.start()
|
||||
else:
|
||||
|
@ -74,3 +74,16 @@ def test_should_break_ties_using_lexical_order(completer, collection):
|
||||
matches = completer.find_matches(text, collection)
|
||||
|
||||
assert matches[1].priority > matches[0].priority
|
||||
|
||||
def test_matching_should_be_case_insensitive(completer):
|
||||
"""Fuzzy matching should keep matches even if letter casing doesn't match.
|
||||
|
||||
This test checks that variations of the text which have different casing
|
||||
are still matched.
|
||||
"""
|
||||
|
||||
text = 'foo'
|
||||
collection = ['Foo', 'FOO', 'fOO']
|
||||
matches = completer.find_matches(text, collection)
|
||||
|
||||
assert len(matches) == 3
|
||||
|
Loading…
Reference in New Issue
Block a user