View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017935 | Scribus | Internal | public | 2026-08-22 07:41 | 2026-08-23 10:26 |
| Reporter | qirat | Assigned To | cbradney | ||
| Priority | normal | Severity | minor | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Platform | Linux | OS | Fedora Workstation | OS Version | 44 |
| Product Version | 1.7.4.svn | ||||
| Fixed in Version | 1.7.4.svn | ||||
| Summary | 0017935: [PATCH] Hyphenator auto-check wrapper refactor | ||||
| Description | I was suggested this refactor by ai while working on the 0014800. I hope it is useful. | ||||
| Additional Information | A report on the patch is attached. | ||||
| Tags | No 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);
| ||||
| Patch | Yes | ||||
| 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 |