Make sure all items managed by their parent get correct handling in SCH_COMMIT.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15129
This commit is contained in:
Jeff Young 2023-07-08 20:36:00 +01:00
parent d48e7f159c
commit 25445d9fe0
1 changed files with 5 additions and 10 deletions

View File

@ -71,16 +71,11 @@ COMMIT& SCH_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN
aItem->ClearFlags( IS_MODIFIED_CHILD ); aItem->ClearFlags( IS_MODIFIED_CHILD );
// If aItem belongs a symbol, the full symbol will be saved because undo/redo does // If aItem belongs a symbol, sheet or label, the full parent will be saved because undo/redo
// not handle "sub items" modifications. // does not handle "sub items" modifications.
if( aItem->GetParent() && aItem->GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T } ) ) if( aItem->GetParent() && aItem->GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T,
{ SCH_SHEET_T,
aItem->SetFlags( IS_MODIFIED_CHILD ); SCH_LABEL_LOCATE_ANY_T } ) )
aItem = aItem->GetParent();
aChangeType = CHT_MODIFY;
}
// Same for fields of a sheet or label
else if( aItem->Type() == SCH_FIELD_T && aItem->GetParent() )
{ {
aItem->SetFlags( IS_MODIFIED_CHILD ); aItem->SetFlags( IS_MODIFIED_CHILD );
aItem = aItem->GetParent(); aItem = aItem->GetParent();