diff -r e7f59f62bbe3 -r b0d8b00fb937 mapeditor.cpp --- a/mapeditor.cpp Sat Jul 23 15:13:34 2005 +0000 +++ b/mapeditor.cpp Mon Jul 25 20:07:18 2005 +0000 @@ -587,12 +587,25 @@ void MapEditor::saveState(const QString & c) { - saveState (UndoCommand,NULL,c); + LinkableMapObj *undoSel; + if (selection) + undoSel=selection; + else + undoSel=NULL; + saveState (UndoCommand,undoSel,c); } void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom) { setChanged(); + + // Save what is selected now + if (undoSel) + undoSelection=undoSel->getSelectString(); + else + undoSelection=""; + + // Save depending on how much needs to be saved if (savemode==UndoCommand) { undoCommand=undoCom; @@ -600,7 +613,7 @@ } else if (savemode==PartOfMap && undoSel) { - undoCommand="undoPart (\""+undoSel->getSelectString()+"\")"; + undoCommand="undoPart (\""+undoSelection+"\")"; backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),undoSel); } else { @@ -1284,6 +1297,10 @@ // Finish open lineEdits if (lineedit) finishedLineEditNoSave(); + // select object before undo + if (!undoSelection.isEmpty()) + select (undoSelection); + parseAtom (undoCommand); mapCenter->reposition();