r24001 by jghali - When using story editor undo, replace Unicode's paragraph separator used by Qt by the one used by Scribus (0x13)

scribus-commit scribus-commit at lists.scribus.net
Sun Aug 30 09:13:38 UTC 2020


Author: jghali
Date: Sun Aug 30 09:13:38 2020
New Revision: 24001

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24001
Log:
When using story editor undo, replace Unicode's paragraph separator used by Qt by the one used by Scribus (0x13)

Modified:
    trunk/Scribus/scribus/ui/storyeditor.cpp

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24001&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp	Sun Aug 30 09:13:38 2020
@@ -479,7 +479,10 @@
 			cursor.setPosition(position + charsAdded, QTextCursor::KeepAnchor);
 			QString addedChars = cursor.selectedText();
 			if (addedChars.length() > 0)
+			{
+				addedChars.replace(QString(0x2029), SpecialChars::PARSEP);
 				StyledText.insertChars(position, addedChars, true);
+			}
 			//qDebug("handleContentsChange : - %01d, + %01d, len %01d", charsRemoved, charsAdded, addedChars.length());
 		}	
 	}
@@ -1090,13 +1093,14 @@
 QMimeData* SEditor::createMimeDataFromSelection () const
 {
 	StyledTextMimeData* mimeData = new StyledTextMimeData();
-	int start = textCursor().selectionStart();
-	int end   = textCursor().selectionEnd();
+	QTextCursor cursor = textCursor();
+	int start = cursor.selectionStart();
+	int end   = cursor.selectionEnd();
 	if (start < 0 || end <= start)
 		return mimeData;
 	StoryText* that = const_cast<StoryText*> (&StyledText);
-	that->select(start, end-start);
-	QString selectedText = textCursor().selectedText();
+	that->select(start, end - start);
+	QString selectedText = cursor.selectedText();
 	selectedText.replace(QChar(0x2029), QChar('\n'));
 	mimeData->setText(selectedText);
 	mimeData->setStyledText(*that, doc);
@@ -2940,18 +2944,8 @@
 	if (!m_textChanged)
 		return;
 	PageItem *nextItem = m_item;
-//#if 0
 	if (m_item->isTextFrame())
-	{
-		while (nextItem != nullptr)
-		{
-			if (nextItem->prevInChain() != nullptr)
-				nextItem = nextItem->prevInChain();
-			else
-				break;
-		}
-	}
-//#endif
+		nextItem = m_item->firstInChain();
 	m_item->invalidateLayout();
 	PageItem* nb2 = nextItem;
 	nb2->itemText.clear();




More information about the scribus-commit mailing list