summaryrefslogtreecommitdiff
path: root/qutebrowser/completion/models/listcategory.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/completion/models/listcategory.py')
-rw-r--r--qutebrowser/completion/models/listcategory.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/qutebrowser/completion/models/listcategory.py b/qutebrowser/completion/models/listcategory.py
index e46f18c69..edf24f5a4 100644
--- a/qutebrowser/completion/models/listcategory.py
+++ b/qutebrowser/completion/models/listcategory.py
@@ -48,11 +48,9 @@ class ListCategory(QSortFilterProxyModel):
log.completion.warning(f"Trimming {len(val)}-char pattern to 5000")
val = val[:5000]
self._pattern = val
-
- # Positive lookahead per search term. This means that all search terms must
- # be matched but they can be matched anywhere in the string, so they can be
- # in any order. For example "foo bar" -> "(?=.*foo)(?=.*bar)"
- val = '(?=.*' + ')(?=.*'.join(map(re.escape, val.split())) + ')'
+ val = re.sub(r' +', r' ', val) # See #1919
+ val = re.escape(val)
+ val = val.replace(r'\ ', '.*')
rx = QRegularExpression(val, QRegularExpression.PatternOption.CaseInsensitiveOption)
qtutils.ensure_valid(rx)
self.setFilterRegularExpression(rx)