View Issue Details

IDProjectCategoryView StatusLast Update
0017975ScribusUndo/Redopublic2026-10-14 20:25
Reporterbuttar Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Fixed in Version1.7.4.svn 
Summary0017975: Compound text chain operations create multiple Undo steps
Description* Groups compound text-chain operations into a single Undo/Redo transaction.
  -- Multi-frame Chain: `[A] [B] [C]` → Chain → `A → B → C` → one Undo → `A B C`
  -- Before/After insertion: inserting S into `A → B → C` now undoes/redoes as one operation.
  -- Multi-selection Break Text Chain and Split Text now undoes/redoes as one operation.
* Reuses the existing low-level `PageItem::link()`, `unlink()`, and `unlinkWithText()` undo states inside an enclosing transaction.
* Preserves current chain order, text-flow behaviour, selection semantics, serialisation, and single-link Undo behaviour.
* Keeps draw-new-frame-and-chain Undo handling out of scope.
Tags#please_test
Attached Files
text-chain-compound-undo-v1.00.patch (2,800 bytes)   
Index: scribus/canvasmode_framelinks.cpp
===================================================================
--- scribus/canvasmode_framelinks.cpp	(revision 27827)
+++ scribus/canvasmode_framelinks.cpp	(working copy)
@@ -41,6 +41,7 @@
 #include "ui/contextmenu.h"
 #include "ui/pageselector.h"
 #include "ui/scrspinbox.h"
+#include "undomanager.h"
 
 
 
@@ -82,6 +83,11 @@
 		switch (m_doc->appMode)
 		{
 		case modeLinkFrames:
+		{
+			UndoTransaction linkTransaction;
+			if (UndoManager::undoEnabled())
+				linkTransaction = UndoManager::instance()->beginTransaction(Um::Selection, Um::ITextFrame, Um::LinkTextFrame, QString(), Um::ITextFrame);
+
 			// if there are more than one text frames selected, link them and exit
 			for(int i = 0; i < m_doc->m_Selection->count(); i++)
 			{
@@ -94,10 +100,14 @@
 					item1->link(item2);
 				}
 			}
+			if (linkTransaction)
+				linkTransaction.commit();
+
 			// now exit and return to the normal mode
 			m_view->requestMode(modeNormal);
 			return;
 		}
+		}
 	}
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
@@ -205,6 +215,10 @@
 				
 				if (currItem->nextInChain() == nullptr && currItem != bblast) //possibility to insert empty frames into chain
 				{
+					UndoTransaction linkTransaction;
+					if (UndoManager::undoEnabled() && bb->prevInChain() != nullptr)
+						linkTransaction = UndoManager::instance()->beginTransaction(Um::Selection, Um::ITextFrame, Um::LinkTextFrame, QString(), Um::ITextFrame);
+
 					if (bb->prevInChain() != nullptr)
 					{
 						ScMessageBox msgBox(QMessageBox::Question, tr("Linking Text Frames"),
@@ -246,6 +260,8 @@
 					if (bb->prevInChain())
 						bb->prevInChain()->unlink();
 					currItem->link(bb);
+					if (linkTransaction)
+						linkTransaction.commit();
 
 					/*
 					// #133881: Remove item renumbering on link as 1.5.x has better drawing methods
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 27827)
+++ scribus/scribusdoc.cpp	(working copy)
@@ -17448,6 +17448,10 @@
 	if (selectedItemCount == 0)
 		return;
 
+	UndoTransaction undoTransaction;
+	if (UndoManager::undoEnabled() && (selectedItemCount > 1))
+		undoTransaction = m_undoManager->beginTransaction(Um::Selection, Um::ITextFrame, Um::UnlinkTextFrame, QString(), Um::ITextFrame);
+
 	for (int i = 0; i < selectedItemCount; ++i)
 	{
 		PageItem *currItem = itemSelection->itemAt(i);
@@ -17456,6 +17460,9 @@
 		if (currItem->nextInChain() || currItem->prevInChain())
 			currItem->unlinkWithText();
 	}
+	if (undoTransaction)
+		undoTransaction.commit();
+
 	regionsChanged()->update(QRectF());
 	changed();
 	itemSelection->itemAt(0)->emitAllToGUI();
PatchYes

Activities

buttar

2026-09-10 12:06

reporter   ~0054453

#Issue
Chaining or splitting several text frames with a single command can require several separate Undo actions to get back to the original state.

Issue History

Date Modified Username Field Change
2026-09-10 12:02 buttar New Issue
2026-09-10 12:02 buttar Tag Attached: #please_test
2026-09-10 12:02 buttar File Added: text-chain-compound-undo-v1.00.patch
2026-09-10 12:06 buttar Note Added: 0054453
2026-10-14 20:16 cbradney Assigned To => cbradney
2026-10-14 20:16 cbradney Status new => resolved
2026-10-14 20:16 cbradney Resolution open => fixed
2026-10-14 20:16 cbradney Fixed in Version => 1.7.4.svn
2026-10-14 20:25 jghali Summary [patch] Compound text chain operations create multiple Undo steps => Compound text chain operations create multiple Undo steps