diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index ac4e62f1a3..80cc475e4e 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -1316,34 +1316,29 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& e if( selectedCells.GetCount() == 1 ) { int row = selectedCells[0].GetRow(); - int col = selectedCells[0].GetCol(); + int flag = m_dataModel->GetRowFlags( row ); + std::vector refs = m_dataModel->GetRowReferences( row ); - if( col == REFERENCE_FIELD ) + // Focus Eeschema view on the symbol selected in the dialog + // TODO: Highlight or select more than one unit + if( ( flag == GROUP_SINGLETON || flag == CHILD_ITEM ) && refs.size() >= 1 ) { - int flag = m_dataModel->GetRowFlags( row ); - std::vector refs = m_dataModel->GetRowReferences( row ); + SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool(); - // Focus Eeschema view on the symbol selected in the dialog - // TODO: Highlight or select more than one unit - if( ( flag == GROUP_SINGLETON || flag == CHILD_ITEM ) && refs.size() >= 1 ) - { - SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool(); + std::sort( refs.begin(), refs.end(), + []( const SCH_REFERENCE& a, const SCH_REFERENCE& b ) + { + return a.GetUnit() < b.GetUnit(); + } ); - std::sort( refs.begin(), refs.end(), - []( const SCH_REFERENCE& a, const SCH_REFERENCE& b ) - { - return a.GetUnit() < b.GetUnit(); - } ); - - // search and highlight the symbol found by its full path. - // It allows select of not yet annotated or duplicaded symbols - wxString symbol_path = refs[0].GetFullPath(); - // wxString reference = refs[0].GetRef() + refs[0].GetRefNumber(); // Not used - editor->FindSymbolAndItem( &symbol_path, nullptr, true, HIGHLIGHT_SYMBOL, wxEmptyString ); - } - - return; + // search and highlight the symbol found by its full path. + // It allows select of not yet annotated or duplicaded symbols + wxString symbol_path = refs[0].GetFullPath(); + // wxString reference = refs[0].GetRef() + refs[0].GetRefNumber(); // Not used + editor->FindSymbolAndItem( &symbol_path, nullptr, true, HIGHLIGHT_SYMBOL, wxEmptyString ); } + + return; } event.Skip();