r22011 by jghali - fix current paragraph style new being shown properly in TP palette when cursor is past last character in frame

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 30 21:08:52 UTC 2017


Author: jghali
Date: Sun Apr 30 21:08:52 2017
New Revision: 22011

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22011
Log:
fix current paragraph style new being shown properly in TP palette when cursor is past last character in frame

Modified:
    trunk/Scribus/scribus/pageitem.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22011&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Sun Apr 30 21:08:52 2017
@@ -1529,7 +1529,8 @@
 		int lastSelected  = qMax(itemText.endOfSelection() - 1, 0);
 		cursorPosition = qMax(firstSelected, qMin(cursorPosition, lastSelected));
 	}
-	if (frameDisplays(cursorPosition))
+	// Note: cursor position can be past last characters, don't use frameDisplays() here
+	if (cursorPosition >= 0 && cursorPosition <= itemText.length())
 		return itemText.paragraphStyle(cursorPosition);
 	return itemText.defaultStyle();
 }
@@ -1544,7 +1545,8 @@
 		int lastSelected  = qMax(itemText.endOfSelection() - 1, 0);
 		cursorPosition = qMax(firstSelected, qMin(cursorPosition, lastSelected));
 	}
-	if (frameDisplays(cursorPosition))
+	// Note: cursor position can be past last characters, don't use frameDisplays() here
+	if (cursorPosition >= 0 && cursorPosition <= itemText.length())
 		return const_cast<ParagraphStyle&>(itemText.paragraphStyle(cursorPosition));
 	else
 		return const_cast<ParagraphStyle&>(itemText.defaultStyle());
@@ -1560,7 +1562,8 @@
 		int lastSelected  = qMax(itemText.endOfSelection() - 1, 0);
 		cursorPosition = qMax(firstSelected, qMin(cursorPosition, lastSelected));
 	}
-	if (frameDisplays(cursorPosition))
+	// Note: cursor position can be past last characters, don't use frameDisplays() here
+	if (cursorPosition >= 0 && cursorPosition <= itemText.length())
 		return itemText.charStyle(cursorPosition);
 	else
 		return itemText.defaultStyle().charStyle();
@@ -1576,7 +1579,8 @@
 	if (itemText.lengthOfSelection() > 0)
 		position = qMin(qMax(itemText.endOfSelection() - 1, 0), qMax(position, itemText.startOfSelection()));
 
-	if (frameDisplays(position))
+	// Note: cursor position can be past last characters, don't use frameDisplays() here
+	if (position >= 0 && position <= itemText.length())
 	{
 		// Do not use setStyle here otherwise char style properties explicitly
 		// set at paragraph level without using styles might get lost




More information about the scribus-commit mailing list