undolink.diff (2,329 bytes)
diff --git a/Scribus/scribus/pageitem.cpp b/Scribus/scribus/pageitem.cpp
index a1c0517..f0dd430 100644
--- a/Scribus/scribus/pageitem.cpp
+++ b/Scribus/scribus/pageitem.cpp
@@ -1298,18 +1298,15 @@ void PageItem::unlink(bool createUndo)
}
}
-
void PageItem::dropLinks()
{
// update auto pointers
if (isAutoText && NextBox == 0)
- {
m_Doc->LastAuto = BackBox;
- }
+
if (isAutoText && BackBox == 0)
- {
m_Doc->FirstAuto = NextBox;
- }
+
isAutoText = false;
// leave text in remaining chain
@@ -1319,16 +1316,11 @@ void PageItem::dropLinks()
{
itemText = StoryText(m_Doc);
if (before)
- before->NextBox = after;
+ before->unlink();
if (after)
{
- after->BackBox = before;
- while (after)
- {
- after->invalid = true;
- after->firstChar = 0;
- after = after->NextBox;
- }
+ unlink();
+ before->link(after);
}
// JG we should set BackBox and NextBox to NULL at a point
BackBox = NextBox = NULL;
diff --git a/Scribus/scribus/scribusdoc.cpp b/Scribus/scribus/scribusdoc.cpp
index bcf8486..5499396 100644
--- a/Scribus/scribus/scribusdoc.cpp
+++ b/Scribus/scribus/scribusdoc.cpp
@@ -10791,7 +10791,7 @@ void ScribusDoc::itemSelection_DeleteItem(Selection* customSelection, bool force
selectedItemCount = delItems.count();
UndoTransaction* activeTransaction = NULL;
- if ((selectedItemCount > 1) && UndoManager::undoEnabled())
+ if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::Group + "/" + Um::Selection, Um::IGroup,
Um::Delete, tooltip, Um::IDelete));
@@ -10801,24 +10801,7 @@ void ScribusDoc::itemSelection_DeleteItem(Selection* customSelection, bool force
if ((currItem->asImageFrame()) && ((ScCore->fileWatcher->files().contains(currItem->Pfile) != 0) && (currItem->PictureIsAvailable)))
ScCore->fileWatcher->removeFile(currItem->Pfile);
if (currItem->asTextFrame())
- {
currItem->dropLinks();
-
- /* this code will instead remove the contained text
- // unlink after
- currItem->unlink();
- if (before != 0)
- {
- // unlink before
- before->unlink();
- // repair link
- if (after != 0)
- {
- before->link(after);
- }
- }
- */
- }
if (currItem->isWelded())
currItem->unWeld();
if (currItem->isBookmark)