View Issue Details

IDProjectCategoryView StatusLast Update
0011010ScribusUndo/Redopublic2012-11-13 20:33
Reportercezaryece Assigned ToChelen  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.0svn 
Fixed in Version1.5.0svn 
Summary0011010: [PATCH] BUG: undo does not restore text frame linking
DescriptionIf you delete linked text frame after undo frame is not linked again.
TagsNo tags attached.
Patch

Activities

Chelen

2012-10-08 16:27

developer  

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)
undolink.diff (2,329 bytes)   

Chelen

2012-10-08 16:29

developer   ~0029023

Here is a patch which solve this issue. With this patch, we have a correct behaviour if we have 3 or more frame linked together and we remove the frame in the middle. (before, the text was not correctly updated in the following frames)

jghali

2012-10-08 21:51

administrator   ~0029025

Patch committed, thanks!

Issue History

Date Modified Username Field Change
2012-08-07 08:11 cezaryece New Issue
2012-08-07 08:11 cezaryece Status new => assigned
2012-08-07 08:11 cezaryece Assigned To => Chelen
2012-08-07 08:33 jghali Priority high => normal
2012-08-07 11:36 cezaryece File Added: undo4welding_linking.diff
2012-08-07 11:54 cezaryece File Deleted: undo4welding_linking.diff
2012-08-08 07:38 cezaryece Summary BUG: undo do not restore text frame linking => BUG: undo does not restore text frame linking
2012-10-08 16:27 Chelen File Added: undolink.diff
2012-10-08 16:29 Chelen Note Added: 0029023
2012-10-08 16:45 Chelen Summary BUG: undo does not restore text frame linking => [PATCH] BUG: undo does not restore text frame linking
2012-10-08 21:51 jghali Note Added: 0029025
2012-10-08 21:51 jghali Status assigned => resolved
2012-10-08 21:51 jghali Fixed in Version => 1.5.0svn
2012-10-08 21:51 jghali Resolution open => fixed
2012-11-13 20:33 cbradney Status resolved => closed