Unselect saved image when reverting a commit if modified item is unselected

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16938
This commit is contained in:
Jon Evans 2024-02-11 11:55:02 -05:00
parent e9be95741b
commit 22669bcc4d
1 changed files with 8 additions and 0 deletions

View File

@ -509,8 +509,16 @@ void SCH_COMMIT::Revert()
if( view )
view->Remove( item );
bool unselect = !item->IsSelected();
item->SwapData( copy );
if( unselect )
{
item->ClearSelected();
item->RunOnChildren( []( SCH_ITEM* aChild ) { aChild->ClearSelected(); } );
}
// Special cases for items which have instance data
if( item->GetParent() && item->GetParent()->Type() == SCH_SYMBOL_T
&& item->Type() == SCH_FIELD_T )