From f8ac6df0cd7792cfadd203a8d5d62b513faa0168 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Feb 2022 13:56:09 +0000 Subject: [PATCH] Implement undo for Eeschema find/replace. Fixes https://gitlab.com/kicad/code/kicad/issues/10824 (cherry picked from commit 33e57930bc9fc2fdfb170f69009af2c410a00761) --- eeschema/tools/sch_editor_control.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 8b2cb59885..1dec233d8d 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -559,6 +559,10 @@ int SCH_EDITOR_CONTROL::ReplaceAndFindNext( const TOOL_EVENT& aEvent ) if( item && item->Matches( data, sheet ) ) { + SCH_ITEM* sch_item = static_cast( item ); + + m_frame->SaveCopyInUndoList( sheet->LastScreen(), sch_item, UNDO_REDO::CHANGED, false ); + if( item->Replace( data, sheet ) ) { m_frame->UpdateItem( item, false, true ); @@ -585,6 +589,9 @@ int SCH_EDITOR_CONTROL::ReplaceAll( const TOOL_EVENT& aEvent ) auto doReplace = [&]( SCH_ITEM* aItem, SCH_SHEET_PATH* aSheet, wxFindReplaceData& aData ) { + m_frame->SaveCopyInUndoList( aSheet->LastScreen(), aItem, UNDO_REDO::CHANGED, + modified ); + if( aItem->Replace( aData, aSheet ) ) { m_frame->UpdateItem( aItem, false, true );