skip highlighter when query is empty

This commit is contained in:
2022-12-18 19:57:45 +01:00
parent addca937c5
commit 493649dad5

View File

@@ -35,6 +35,12 @@ class HighlightRegex(Highlight):
def compute_highlight(self, line: Line) -> Optional[List[HighlightedRange]]:
result = []
if len(self.query) == 0:
# query is empty - this would result in many hits and is quite expensive
# This happens with the highlighter we use for the selected text and maybe for the current filter query.
return result
# print("execute regex: %s in %s" % (self.regex, line.line()))
match_iter = re.finditer(self.regex, line.line())
for match in match_iter: