View Issue Details

IDProjectCategoryView StatusLast Update
0017935ScribusInternalpublic2026-08-23 10:26
Reporterqirat Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Fixed in Version1.7.4.svn 
Summary0017935: [PATCH] Hyphenator auto-check wrapper refactor
DescriptionI was suggested this refactor by ai while working on the 0014800.

I hope it is useful.
Additional InformationA report on the patch is attached.
TagsNo tags attached.
Attached Files
hyphenator_autohyphenate_wrapper_v1.01.patch (4,998 bytes)   
Index: scribus/hyphenator.h
===================================================================
--- scribus/hyphenator.h	(revision 27773)
+++ scribus/hyphenator.h	(working copy)
@@ -104,6 +104,11 @@
 	*/
 	void slotHyphenate(PageItem *it);
 	/*!
+	\brief Hyphenates \a it, but only if automatic hyphenation is enabled.
+	\param it references \see PageItem - text frame.
+	*/
+	void autoHyphenate(PageItem *it) { if (m_autoCheck) slotHyphenate(it); }
+	/*!
 	\fn void Hyphenator::slotDeHyphenate(PageItem* it)
 	\brief Removes hyphenation either for the whole text frame or the selected text if there is a selection.
 	\date

Index: scribus/canvasmode_edit.cpp
===================================================================
--- scribus/canvasmode_edit.cpp	(revision 27773)
+++ scribus/canvasmode_edit.cpp	(working copy)
@@ -718,8 +718,7 @@
 					{
 						// K.I.S.S.:
 						currItem->itemText.insertChars(0, cc, true);
-						if (m_doc->docHyphenator->autoCheck())
-							m_doc->docHyphenator->slotHyphenate(currItem);
+						m_doc->docHyphenator->autoHyphenate(currItem);
 						m_ScMW->BookMarkTxT(currItem);
 						//							m_ScMW->outlinePalette->BuildTree();
 					}

Index: scribus/gtaction.cpp
===================================================================
--- scribus/gtaction.cpp	(revision 27773)
+++ scribus/gtaction.cpp	(working copy)
@@ -836,8 +836,7 @@
 
 void gtAction::finalize()
 {
-	if (m_textFrame->doc()->docHyphenator->autoCheck())
-		m_textFrame->doc()->docHyphenator->slotHyphenate(m_textFrame);
+	m_textFrame->doc()->docHyphenator->autoHyphenate(m_textFrame);
 	m_textFrame->doc()->regionsChanged()->update(QRectF());
 	m_textFrame->doc()->changed();
 	m_textFrame->doc()->changedPagePreview();

Index: scribus/ui/loremipsum.cpp
===================================================================
--- scribus/ui/loremipsum.cpp	(revision 27773)
+++ scribus/ui/loremipsum.cpp	(working copy)
@@ -322,8 +322,7 @@
 
 		int l = item2->itemText.length();
 		item2->itemText.insertChars(l, sampleText);
-		if (m_Doc->docHyphenator->autoCheck())
-			m_Doc->docHyphenator->slotHyphenate(item2);
+		m_Doc->docHyphenator->autoHyphenate(item2);
 		item2->asTextFrame()->invalidateLayout(true);
 	}
 	m_Doc->regionsChanged()->update(QRectF());

Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27773)
+++ scribus/scribus.cpp	(working copy)
@@ -3849,8 +3849,7 @@
 			gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, false, impsetup.prefixNames);
 		}
 		delete gt;
-		if (doc->docHyphenator->autoCheck())
-			doc->docHyphenator->slotHyphenate(currItem);
+		doc->docHyphenator->autoHyphenate(currItem);
 		for (int a = 0; a < doc->Items->count(); ++a)
 		{
 			if (doc->Items->at(a)->isBookmark)
@@ -3900,8 +3899,7 @@
 		return; // not a text frame
 
 	ScGTPluginManager::instance()->run();
-	if (doc->docHyphenator->autoCheck())
-		doc->docHyphenator->slotHyphenate(currItem);
+	doc->docHyphenator->autoHyphenate(currItem);
 	for (int a = 0; a < doc->Items->count(); ++a)
 	{
 		if (doc->Items->at(a)->isBookmark)
@@ -4835,8 +4833,7 @@
 			scclipproc.setContent(clipContent, ScClipboardProcessor::ContentType::Text);
 			scclipproc.process();
 		}
-		if (doc->docHyphenator->autoCheck())
-			doc->docHyphenator->slotHyphenate(currItem);
+		doc->docHyphenator->autoHyphenate(currItem);
 		if (doc->appMode == modeEditTable)
 			selItem->asTable()->update();
 		else

Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 27773)
+++ scribus/scribusview.cpp	(working copy)
@@ -943,8 +943,7 @@
 						item->itemText.insertChars(txt, true);
 					}
 				}
-				if (m_doc->docHyphenator->autoCheck())
-					m_doc->docHyphenator->slotHyphenate(item);
+				m_doc->docHyphenator->autoHyphenate(item);
 				item->invalidateLayout();
 				item->update();
 			}
@@ -1741,18 +1740,15 @@
 			table->adjustFrameToTable();
 			table->updateClip();
 
-			if (m_doc->docHyphenator->autoCheck())
+			// Merged cells share one text frame across several slots.
+			QSet<PageItem_TextFrame*> cellFrames;
+			for (int row = 0; row < table->rows(); ++row)
 			{
-				// Merged cells share one text frame across several slots.
-				QSet<PageItem_TextFrame*> cellFrames;
-				for (int row = 0; row < table->rows(); ++row)
-				{
-					for (int col = 0; col < table->columns(); ++col)
-						cellFrames.insert(table->cellAt(row, col).textFrame());
-				}
-				for (PageItem_TextFrame* cellFrame : std::as_const(cellFrames))
-					m_doc->docHyphenator->slotHyphenate(cellFrame);
+				for (int col = 0; col < table->columns(); ++col)
+					cellFrames.insert(table->cellAt(row, col).textFrame());
 			}
+			for (PageItem_TextFrame* cellFrame : std::as_const(cellFrames))
+				m_doc->docHyphenator->autoHyphenate(cellFrame);
 
 			deselectItems(true);
 			m_doc->m_Selection->addItem(table);
PatchYes

Activities

Issue History

Date Modified Username Field Change
2026-08-22 07:41 qirat New Issue
2026-08-22 07:41 qirat File Added: hyphenator_autohyphenate_wrapper_report.pdf
2026-08-22 07:41 qirat File Added: hyphenator_autohyphenate_wrapper_v1.01.patch
2026-08-22 07:49 qirat Tag Attached: #please_test
2026-08-22 13:48 cbradney Assigned To => cbradney
2026-08-22 13:48 cbradney Status new => resolved
2026-08-22 13:48 cbradney Resolution open => fixed
2026-08-22 13:48 cbradney Fixed in Version => 1.7.4.svn
2026-08-22 14:18 qirat Tag Detached: #please_test
2026-08-23 10:26 cbradney Status resolved => closed