summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qutebrowser/completion/models/listcategory.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/qutebrowser/completion/models/listcategory.py b/qutebrowser/completion/models/listcategory.py
index 226f5e999..f92679cc6 100644
--- a/qutebrowser/completion/models/listcategory.py
+++ b/qutebrowser/completion/models/listcategory.py
@@ -52,8 +52,9 @@ class ListCategory(QSortFilterProxyModel):
# 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())) + ')'
- rx = QRegularExpression(val, QRegularExpression.PatternOption.CaseInsensitiveOption)
+ re_pattern = "^" + "".join(f"(?=.*{re.escape(term)})" for term in val.split())
+
+ rx = QRegularExpression(re_pattern, QRegularExpression.PatternOption.CaseInsensitiveOption)
qtutils.ensure_valid(rx)
self.setFilterRegularExpression(rx)
self.invalidate()