Avoid doubly-inserting wires when repeating

The repeat key should only insert one copy.  We don't want to depend on
later cleanup
This commit is contained in:
Seth Hillbrand 2025-08-19 14:40:48 -07:00
parent b6b8a6d465
commit cea77b7e9b

View File

@ -1237,6 +1237,9 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments( SCH_COMMIT& aCommit )
aCommit.Added( m_busUnfold.label, screen ); aCommit.Added( m_busUnfold.label, screen );
m_frame->AddCopyForRepeatItem( m_busUnfold.label ); m_frame->AddCopyForRepeatItem( m_busUnfold.label );
m_busUnfold.label->ClearEditFlags(); m_busUnfold.label->ClearEditFlags();
if( !m_wires.empty() )
m_frame->AddCopyForRepeatItem( m_wires[0] );
} }
else if( !m_wires.empty() ) else if( !m_wires.empty() )
{ {
@ -1246,10 +1249,6 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments( SCH_COMMIT& aCommit )
for( size_t ii = 1; ii < m_wires.size(); ++ii ) for( size_t ii = 1; ii < m_wires.size(); ++ii )
m_frame->AddCopyForRepeatItem( m_wires[ii] ); m_frame->AddCopyForRepeatItem( m_wires[ii] );
// Get the last non-null wire (this is the last created segment).
if( !m_wires.empty() )
m_frame->AddCopyForRepeatItem( m_wires.back() );
// Add the new wires // Add the new wires
for( SCH_LINE* wire : m_wires ) for( SCH_LINE* wire : m_wires )
{ {