Fix handling of spaces in completion

This is a regression introduced in
faa052ad6f.

Fixes #1934.
This commit is contained in:
Florian Bruhin 2016-09-08 21:59:18 +02:00
parent 861ce478b3
commit 0a3853fcb7
2 changed files with 3 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class CompletionFilterModel(QSortFilterProxyModel):
with debug.log_time(log.completion, 'Setting filter pattern'):
self.pattern = val
val = re.escape(val)
val = val.replace(r'\ +', r'.*')
val = re.sub(r'\ +', r'.*', val)
self.pattern_re = re.compile(val, re.IGNORECASE)
self.invalidate()
sortcol = 0

View File

@ -62,6 +62,8 @@ def _extract_model_data(model):
@pytest.mark.parametrize('pattern, data, expected', [
('foo', 'barfoobar', True),
('foo bar', 'barfoobar', True),
('foo bar', 'barfoobar', True),
('foo', 'barFOObar', True),
('Foo', 'barfOObar', True),
('ab', 'aonebtwo', False),