Implement undo for Eeschema find/replace.

Fixes https://gitlab.com/kicad/code/kicad/issues/10824

(cherry picked from commit 33e57930bc)
This commit is contained in:
Jeff Young 2022-02-11 13:56:09 +00:00
parent 310e339c39
commit f8ac6df0cd
1 changed files with 7 additions and 0 deletions

View File

@ -559,6 +559,10 @@ int SCH_EDITOR_CONTROL::ReplaceAndFindNext( const TOOL_EVENT& aEvent )
if( item && item->Matches( data, sheet ) ) if( item && item->Matches( data, sheet ) )
{ {
SCH_ITEM* sch_item = static_cast<SCH_ITEM*>( item );
m_frame->SaveCopyInUndoList( sheet->LastScreen(), sch_item, UNDO_REDO::CHANGED, false );
if( item->Replace( data, sheet ) ) if( item->Replace( data, sheet ) )
{ {
m_frame->UpdateItem( item, false, true ); m_frame->UpdateItem( item, false, true );
@ -585,6 +589,9 @@ int SCH_EDITOR_CONTROL::ReplaceAll( const TOOL_EVENT& aEvent )
auto doReplace = auto doReplace =
[&]( SCH_ITEM* aItem, SCH_SHEET_PATH* aSheet, wxFindReplaceData& aData ) [&]( SCH_ITEM* aItem, SCH_SHEET_PATH* aSheet, wxFindReplaceData& aData )
{ {
m_frame->SaveCopyInUndoList( aSheet->LastScreen(), aItem, UNDO_REDO::CHANGED,
modified );
if( aItem->Replace( aData, aSheet ) ) if( aItem->Replace( aData, aSheet ) )
{ {
m_frame->UpdateItem( aItem, false, true ); m_frame->UpdateItem( aItem, false, true );