Be more careful with undo, and don't re-merge a bus over a bus entry.

Fixes https://gitlab.com/kicad/code/kicad/issues/9475
This commit is contained in:
Jeff Young 2021-10-30 19:57:30 +01:00
parent c5cdda26ae
commit f345eacf13
2 changed files with 19 additions and 3 deletions

View File

@ -455,6 +455,16 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew ) const
break;
case SCH_BUS_WIRE_ENTRY_T:
if( item->IsConnected( aPosition ) )
{
breakLines[ BUSES ] = true;
exitAngles[ BUSES ].insert( uniqueAngle++ );
breakLines[ WIRES ] = true;
exitAngles[ WIRES ].insert( uniqueAngle++ );
}
break;
case SCH_SYMBOL_T:
case SCH_SHEET_T:
if( item->IsConnected( aPosition ) )

View File

@ -1319,18 +1319,24 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
// Inform tools that undo command was issued
m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
/* Get the old list */
// Get the old list
PICKED_ITEMS_LIST* List = m_frame->PopCommandFromUndoList();
size_t num_undos = m_frame->m_undoList.m_CommandsList.size();
/* Undo the command */
// The cleanup routines normally run after an operation and so attempt to append their
// undo items onto the operation's list. However, in this case that's going be the list
// under us, which we don't want, so we push a dummy list onto the stack.
PICKED_ITEMS_LIST* dummy = new PICKED_ITEMS_LIST();
m_frame->PushCommandToUndoList( dummy );
m_frame->PutDataInPreviousState( List );
m_frame->SetSheetNumberAndCount();
m_frame->TestDanglingEnds();
m_frame->OnPageSettingsChange();
// If we modified anything during cleanup we don't want it going on the undolist
// The cleanup routines *should* have appended to our dummy list, but just to be doubly
// sure pop any other new lists off the stack as well
while( m_frame->m_undoList.m_CommandsList.size() > num_undos )
delete m_frame->PopCommandFromUndoList();