r24422 by jghali - #16443: Linked text boxes: text re-starts from beginning when text is displaced entirely from one of the linked boxes

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 24 16:59:05 UTC 2021


Author: jghali
Date: Sun Jan 24 16:59:05 2021
New Revision: 24422

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24422
Log:
#16443: Linked text boxes: text re-starts from beginning when text is displaced entirely from one of the linked boxes

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24422&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Sun Jan 24 16:59:05 2021
@@ -1158,19 +1158,20 @@
 void PageItem_TextFrame::adjustParagraphEndings ()
 {
 	// More text to go - let's apply paragraph flowing options - orphans/widows, etc
-	int pos = textLayout.endOfFrame() - 1;
-	if (pos >= itemText.length() - 1)
+	int start = textLayout.startOfFrame();
+	int end = textLayout.endOfFrame() - 1;
+	if ((start > end) || (end >= itemText.length() - 1))
 		return;
 
-	ParagraphStyle style = itemText.paragraphStyle (pos);
-	int paragraphStart = itemText.prevParagraph (pos) + 1;
-	QChar lastChar = itemText.text (pos);
+	ParagraphStyle style = itemText.paragraphStyle (end);
+	int paragraphStart = itemText.prevParagraph (end) + 1;
+	QChar lastChar = itemText.text (end);
 	bool keepWithNext = style.keepWithNext() && (lastChar == SpecialChars::PARSEP);
 	if (keepWithNext || (!SpecialChars::isBreak (lastChar, true)))
 	{
 		// paragraph continues in the next frame, or needs to be kept with the next one
 		// check how many lines are in this frame
-		int lineStart = textLayout.startOfLine (pos);
+		int lineStart = textLayout.startOfLine (end);
 		incompleteLines = 1;
 		incompletePositions.prepend (lineStart);
 		while (lineStart > paragraphStart)




More information about the scribus-commit mailing list