IDE: Fix search result not showing single occurrences
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 20 Aug 2024 00:31:45 +0200
changeset 3971 f1c673cddc1f
parent 3970 d73a477237ef
child 3972 5d46adf7bbba
IDE: Fix search result not showing single occurrences
controls/SearchResultPanel.py
--- a/controls/SearchResultPanel.py	Sun Aug 18 18:23:18 2024 +0200
+++ b/controls/SearchResultPanel.py	Tue Aug 20 00:31:45 2024 +0200
@@ -172,7 +172,7 @@
                 "type": ITEM_PROJECT,
                 "data": None,
                 "text": None,
-                "matches": None,
+                "matches": 0,
             }
             search_results_tree_children = search_results_tree_infos.setdefault("children", [])
             for tagname in self.ElementsOrder:
@@ -291,7 +291,7 @@
             start_idx = start[1]
             end_idx = reduce(lambda x, y: x + y, [len(x) + 1 for x in text_lines[:end[0] - start[0]]], end[1] + 1)
             style = wx.TextAttr(wx.BLACK, wx.Colour(206, 204, 247))
-        elif infos["type"] is not None and infos["matches"] > 1:
+        elif infos["type"] is not None and infos["matches"] > 0:
             text = _("(%d matches)") % infos["matches"]
             start_idx, end_idx = 0, len(text)
             style = wx.TextAttr(wx.Colour(0, 127, 174))