← Back to team overview

kicad-developers team mailing list archive

PATCH: exact match of component with sub-units in schematic did not show

 

Hi,
so here one digit patch.

Problem Symptom: in the schematic symbol chooser, if you search for an
exact match of a component with multiple units, it is not selected.
For instance, search for

   74LS00

The scored element is in the tree, but you need to manually unfold it
(see before.png image). This usually works otherwise (I suspect it has
to do with the fact that there are sub-units).

The attached change will reliably select the first unit of that
particular symbol and fix the problem (after.png image).

Now it might be up for debate if the search should actually unfold to
the first unit or if the tree unfolding should stop at the 74LS00 part
- I guess if the latter is wished, something dependent on
tree-children needs to be introduced. I leave that up to you.

Attached: patch (against 5.1 branch), before image and after image.

Cheers,
  Henner.
diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp
index 0a26788af..6ce97930c 100644
--- a/common/lib_tree_model_adapter.cpp
+++ b/common/lib_tree_model_adapter.cpp
@@ -451,7 +451,7 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
                    []( LIB_TREE_NODE const* n )
                    {
                        // return leaf nodes with some level of matching
-                       return n->Children.size() == 0 && n->Score > 1;
+                       return n->Children.size() == 0 && n->Score > 0;
                    },
                    &highScore );
 

Attachment: before.png
Description: PNG image

Attachment: after.png
Description: PNG image


Follow ups