* Optimized result highlighter callback.
authorUrban Wallasch <urban.wallasch@freenet.de>
Mon, 14 Jun 2021 13:16:28 +0000 (15:16 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Mon, 14 Jun 2021 13:16:28 +0000 (15:16 +0200)
jiten-pai.py

index 5f8267ecf5c098a5c7acf7def636addccb3a94e0..00c40825b1ab0a072c688a615a8d14ce9d97a59d 100755 (executable)
@@ -232,10 +232,9 @@ class jpMainWindow(QMainWindow):
         re_term = re.compile(self.search_box.lineEdit().text(), re.IGNORECASE)
         nfmt = '<div style="font-family: %s; font-size: %dpt">' % (cfg['font'], cfg['font_sz'])
         lfmt = '<span style="font-family: %s; font-size: %dpt;">' % (cfg['lfont'], cfg['lfont_sz'])
-        hl = '<span style="color: %s;">' % cfg['hl_col']
         html = [nfmt]
         def hl_repl(match):
-            return hl + match.group(0) + '</span>'
+            return '<span style="color: %s;">%s</span>' % (cfg['hl_col'], match.group(0))
         for res in result:
             # highlight matches
             for i in range(len(res)):