r21820 by jghali - #14414: Wrong cursor placement with the last paragraph in a text frame

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 12 22:58:47 UTC 2017


Author: jghali
Date: Sun Mar 12 22:58:47 2017
New Revision: 21820

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21820
Log:
#14414: Wrong cursor placement with the last paragraph in a text frame

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

Modified: trunk/Scribus/scribus/text/boxes.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21820&path=/trunk/Scribus/scribus/text/boxes.cpp
==============================================================================
--- trunk/Scribus/scribus/text/boxes.cpp	(original)
+++ trunk/Scribus/scribus/text/boxes.cpp	Sun Mar 12 22:58:47 2017
@@ -33,6 +33,18 @@
 				return result;
 		}
 	}
+
+	if (containsPoint(coord) && (m_boxes.count() > 0))
+	{
+		LineBox* firstLine = dynamic_cast<LineBox*>(m_boxes.first());
+		if (firstLine && (coord.y() < firstLine->y()))
+			return firstLine->firstChar();
+
+		LineBox* lastLine = dynamic_cast<LineBox*>(m_boxes.last());
+		if (lastLine && (coord.y() > (lastLine->y() + lastLine->naturalHeight())))
+			return lastLine->lastChar() + 1;
+	}
+
 	return -1;
 }
 
@@ -165,6 +177,13 @@
 					position = firstChar();
 				else
 					position = lastChar();
+			}
+			if (position == story.length() - 1)
+			{
+				if (m_firstChar == m_lastChar)
+					position = m_lastChar;
+				else if (!SpecialChars::isBreak(story.text(position)))
+					position = story.length();
 			}
 		}
 	}




More information about the scribus-commit mailing list