diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index bf29899bdb..6f12d7c973 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -355,7 +355,7 @@ SCH_ITEM* SCH_SCREEN::GetItem( const VECTOR2I& aPosition, int aAccuracy, KICAD_T } -std::set SCH_SCREEN::MarkConnections( SCH_LINE* aSegment ) +std::set SCH_SCREEN::MarkConnections( SCH_LINE* aSegment, bool aIgnorePins ) { std::set retval; std::stack to_search; @@ -384,9 +384,9 @@ std::set SCH_SCREEN::MarkConnections( SCH_LINE* aSegment ) SCH_LINE* line = static_cast( item ); if( ( test_item->IsEndPoint( line->GetStartPoint() ) - && !GetPin( line->GetStartPoint(), nullptr, true ) ) + && ( aIgnorePins || !GetPin( line->GetStartPoint(), nullptr, true ) ) ) || ( test_item->IsEndPoint( line->GetEndPoint() ) - && !GetPin( line->GetEndPoint(), nullptr, true ) ) ) + && ( aIgnorePins || !GetPin( line->GetEndPoint(), nullptr, true ) ) ) ) { auto result = retval.insert( line ); diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h index df7c15d92b..408be8ffdd 100644 --- a/eeschema/sch_screen.h +++ b/eeschema/sch_screen.h @@ -301,7 +301,7 @@ public: * * @param aSegment The segment to test for connections. */ - std::set MarkConnections( SCH_LINE* aSegment ); + std::set MarkConnections( SCH_LINE* aSegment, bool aIgnorePins ); /** * Clear the state flags of all the items in the screen. diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 2bb1e43b64..e035370ba3 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1430,12 +1430,26 @@ int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent ) SCH_LINE* line = (SCH_LINE*) m_selection.Front(); EDA_ITEMS items; + unsigned done = false; m_frame->GetScreen()->ClearDrawingState(); - std::set conns = m_frame->GetScreen()->MarkConnections( line ); + std::set conns = m_frame->GetScreen()->MarkConnections( line, false ); for( SCH_ITEM* item : conns ) + { + if( item->IsType( wiresAndBuses ) && !item->IsSelected() ) + done = true; + select( item ); + } + + if( !done ) + { + conns = m_frame->GetScreen()->MarkConnections( line, true ); + + for( SCH_ITEM* item : conns ) + select( item ); + } if( m_selection.GetSize() > 1 ) m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );