From 539d14ce94a28e7b63ebd8cebbc4b1498df41da2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 29 Jul 2021 16:51:12 +0100 Subject: [PATCH] Fix hang-over from legacy canvas where we only looked at sel head. Fixes https://gitlab.com/kicad/code/kicad/issues/8886 --- eeschema/tools/sch_edit_tool.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index a6a47fe2a8..e0a66c4103 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1156,14 +1156,17 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent ) if( selection.Empty() ) return 0; - SCH_ITEM* item = static_cast( selection.Front() ); + for( EDA_ITEM* item : selection ) + { + SCH_ITEM* sch_item = static_cast( item ); - if( !item->IsNew() ) - saveCopyInUndoList( item, UNDO_REDO::CHANGED ); + if( !sch_item->IsNew() ) + saveCopyInUndoList( sch_item, UNDO_REDO::CHANGED ); - item->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true ); + sch_item->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true ); + updateItem( sch_item, true ); + } - updateItem( item, true ); m_frame->OnModify(); if( selection.IsHover() ) @@ -1595,12 +1598,12 @@ int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent ) std::vector lines; - for( auto& item : selection ) + for( EDA_ITEM* item : selection ) { if( SCH_LINE* line = dyn_cast( item ) ) { if( !line->IsEndPoint( cursorPos ) ) - lines.push_back( line ); + lines.push_back( line ); } }