r21918 by jghali - fix incorrect display of text properties in case where cursor is placed at beginning of paragraph

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 16 15:17:51 UTC 2017


Author: jghali
Date: Sun Apr 16 15:17:51 2017
New Revision: 21918

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21918
Log:
fix incorrect display of text properties in case where cursor is placed at beginning of paragraph

Modified:
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21918&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp	(original)
+++ trunk/Scribus/scribus/scribusview.cpp	Sun Apr 16 15:17:51 2017
@@ -1731,8 +1731,14 @@
 
 		if (textFrame->itemText.length() > 0)
 		{
-			int pos = qMax(qMin(textFrame->itemText.cursorPosition() - 1, textFrame->itemText.length()), 0);
-			Doc->currentStyle.charStyle() = textFrame->itemText.charStyle(pos);
+			int pos = qMax(0, qMin(textFrame->itemText.cursorPosition(), textFrame->itemText.length()));
+			if (textFrame->itemText.lengthOfSelection() > 0)
+			{
+				int firstSelected = textFrame->itemText.startOfSelection();
+				int lastSelected  = qMax(textFrame->itemText.endOfSelection() - 1, 0);
+				pos = qMax(firstSelected, qMin(pos, lastSelected));
+			}
+			Doc->currentStyle.charStyle() = textFrame->currentCharStyle();
 			emit ItemCharStyle(Doc->currentStyle.charStyle());
 			emit ItemTextEffects(Doc->currentStyle.charStyle().effects());
 			emit ItemTextAlign(textFrame->itemText.paragraphStyle(pos).alignment());




More information about the scribus-commit mailing list