From e47351d1a671c3247b489f166c3239cf38034ab0 Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Sun, 19 Aug 2018 17:57:09 +0100
Subject: [PATCH] Highlight only leaf nodes when filtering lib tree.

Fixes: lp:1787709
* https://bugs.launchpad.net/kicad/+bug/1787709
---
 common/lib_tree_model_adapter.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp
index 098a27dd57..aa34804490 100644
--- a/common/lib_tree_model_adapter.cpp
+++ b/common/lib_tree_model_adapter.cpp
@@ -382,7 +382,8 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowResults()
     FindAndExpand( m_tree,
                    []( LIB_TREE_NODE const* n )
                    {
-                       return /*n->Type == LIB_TREE_NODE::TYPE::LIBID &&*/ n->Score > 1;
+                       // return leaf nodes with some level of matching
+                       return n->Children.size() == 0 && n->Score > 1;
                    },
                    &highScore );