Eeschema, cross-probing: fix incorrect unit selection when highlight a pin.

Highlight a pin of a multi-unit symbol from Pcbnew did not always select the right part.
Fixes #8087
https://gitlab.com/kicad/code/kicad/issues/8087
This commit is contained in:
jean-pierre charras 2021-04-07 19:48:02 +02:00
parent 18f07024a6
commit 677d7b0a60
1 changed files with 9 additions and 0 deletions

View File

@ -75,8 +75,17 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindComponentAndItem( const wxString& aReference,
pos = component->GetPosition(); // temporary: will be changed if the pin is found.
pin = component->GetPin( aSearchText );
// Ensure we have found the right unit in case of multi-units symbol
if( pin )
{
int unit = pin->GetLibPin()->GetUnit();
if( unit != 0 && unit != component->GetUnit() )
{
pin = nullptr;
continue;
}
// Get pin position in true schematic coordinate
pos = pin->GetPosition();
foundItem = pin;