r22468 by jghali - #15260: Crash when trying to select two cell in table with ctrl+shift+right arrow

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 12 22:41:45 UTC 2018


Author: jghali
Date: Thu Apr 12 22:41:45 2018
New Revision: 22468

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22468
Log:
#15260: Crash when trying to select two cell in table with ctrl+shift+right arrow

Modified:
    trunk/Scribus/scribus/text/storytext.cpp

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22468&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp	(original)
+++ trunk/Scribus/scribus/text/storytext.cpp	Thu Apr 12 22:41:45 2018
@@ -245,13 +245,16 @@
 	if (paragraphStyle().direction() == ParagraphStyle::RTL)
 	{
 		pos = it->following(pos);
-		if (pos < length() && text(pos).isSpace())
-			pos += 1;
+		if (pos != BreakIterator::DONE)
+		{
+			while (pos < length() && text(pos).isSpace())
+				pos += 1;
+		}
 	}
 	else
 	{
 		pos = cursorPosition();
-		if (pos > 0 && text(pos - 1).isSpace())
+		while (pos > 0 && text(pos - 1).isSpace())
 			pos -= 1;
 		pos = it->preceding(pos);
 	}
@@ -271,15 +274,18 @@
 	if (paragraphStyle().direction() == ParagraphStyle::RTL)
 	{
 		pos = cursorPosition();
-		if (pos > 0 && text(pos - 1).isSpace())
+		while (pos > 0 && text(pos - 1).isSpace())
 			pos -= 1;
 		pos = it->preceding(pos);
 	}
 	else
 	{
 		pos = it->following(pos);
-		if (pos < length() && text(pos).isSpace())
-			pos += 1;
+		if (pos != BreakIterator::DONE)
+		{
+			while (pos < length() && text(pos).isSpace())
+				pos += 1;
+		}
 	}
 
 	if (pos != BreakIterator::DONE)




More information about the scribus-commit mailing list