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:
parent
310e339c39
commit
f8ac6df0cd
|
@ -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 );
|
||||||
|
|
Loading…
Reference in New Issue