From 59cc7b2d3e7bdac50351b832773581499f8cd43e Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 30 Nov 2023 11:28:43 -0500 Subject: [PATCH] Fix unconnected schematic net highlighting issue. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16218 (cherry picked from commit 23175c163f9493a09701fc5372b072c15c48b014) --- eeschema/tools/sch_editor_control.cpp | 49 +++++---------------------- 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index b6a37901ce..c9162f68a4 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1039,13 +1039,10 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent ) { connNames.emplace( selectedName ); - if( m_highlightBusMembers ) + CONNECTION_SUBGRAPH* sg = connectionGraph->FindSubgraphByName( selectedName, sheetPath ); + + if( sg && m_highlightBusMembers ) { - CONNECTION_SUBGRAPH* sg = connectionGraph->FindSubgraphByName( selectedName, - sheetPath ); - - wxCHECK( sg, 0 ); - for( const SCH_ITEM* item : sg->GetItems() ) { wxCHECK2( item, continue ); @@ -1156,43 +1153,15 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent ) wxCHECK2( itemConn, continue ); - bool selectedIsNoNet = false; - CONNECTION_SUBGRAPH* selectedSubgraph = nullptr; - - if( itemConn->Driver() == nullptr ) + if( !item->IsBrightened() && connNames.count( itemConn->Name() ) ) { - selectedIsNoNet = true; - selectedSubgraph = connectionGraph->GetSubgraphForItem( itemConn->Parent() ); + item->SetBrightened(); + redrawItem = item; } - - if( selectedIsNoNet && selectedSubgraph ) + else if( item->IsBrightened() && !connNames.count( itemConn->Name() ) ) { - for( SCH_ITEM* subgraphItem : selectedSubgraph->GetItems() ) - { - if( !item->IsBrightened() && ( item == subgraphItem ) ) - { - item->SetBrightened(); - redrawItem = item; - } - else if( item->IsBrightened() && ( item != subgraphItem ) ) - { - item->ClearBrightened(); - redrawItem = item; - } - } - } - else - { - if( !item->IsBrightened() && connNames.count( itemConn->Name() ) ) - { - item->SetBrightened(); - redrawItem = item; - } - else if( item->IsBrightened() && !connNames.count( itemConn->Name() ) ) - { - item->ClearBrightened(); - redrawItem = item; - } + item->ClearBrightened(); + redrawItem = item; } }