diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 553f790639..4434ef53c0 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -657,6 +657,16 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen ) itemList.PushItem( ITEM_PICKER( aItem, UR_DELETED ) ); }; + auto add_junction = [ & ]( const wxPoint& aPosition ) -> void + { + auto junction = new SCH_JUNCTION( aPosition ); + AddToScreen( junction, aScreen ); + BreakSegments( aPosition, aUndo ); + + if( aUndo ) + SaveCopyInUndoList( junction, UR_NEW, true ); + }; + BreakSegmentsOnJunctions( true, aScreen ); for( item = aScreen->GetDrawItems(); item; item = item->Next() ) @@ -739,6 +749,16 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen ) if( item->GetFlags() & STRUCT_DELETED ) RemoveFromScreen( item, aScreen ); + else if( item->Type() == SCH_LINE_T ) + { + auto line = static_cast( item ); + + if( aScreen->IsJunctionNeeded( line->GetStartPoint(), true ) ) + add_junction( line->GetStartPoint() ); + + if( aScreen->IsJunctionNeeded( line->GetEndPoint(), true ) ) + add_junction( line->GetEndPoint() ); + } } if( itemList.GetCount() && aUndo )