The screen for undo is the screen that *owns* the SCH_SHEET...

... not the screen the SCH_SHEET owns.

Fixes https://gitlab.com/kicad/code/kicad/issues/14099
This commit is contained in:
Jeff Young 2023-03-03 00:22:05 +00:00
parent f24deac017
commit 5849458476
1 changed files with 5 additions and 2 deletions

View File

@ -290,8 +290,11 @@ void HIERARCHY_PANE::onRightClick( wxTreeEvent& aEvent )
if( dlg.ShowModal() == wxID_OK && dlg.GetValue() != itemData->m_SheetPath.GetPageNumber() )
{
m_frame->SaveCopyInUndoList( itemData->m_SheetPath.LastScreen(),
itemData->m_SheetPath.Last(), UNDO_REDO::CHANGED, false );
SCH_SHEET_PATH parentPath = itemData->m_SheetPath;
parentPath.pop_back();
m_frame->SaveCopyInUndoList( parentPath.LastScreen(), itemData->m_SheetPath.Last(),
UNDO_REDO::CHANGED, false );
itemData->m_SheetPath.SetPageNumber( dlg.GetValue() );