summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
031078c)
Previously, it does not align the last line with no character.
So the cursor position in the last empty line is not aligned.
Now it tests whether the alignment target indices includes end of the text
and the last line is generated but empty.
Change-Id: Icc525a94cdaca7e926c06a6615d6e319d7c55ae1
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
// Set the primary cursor's position.
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
// Set the primary cursor's position.
- cursorInfo.primaryPosition.x = 0.f;
+ cursorInfo.primaryPosition.x = ( LTR == line.direction ) ? newLine.alignmentOffset : parameters.visualModel->mControlSize.width - newLine.alignmentOffset;
cursorInfo.primaryPosition.y = cursorInfo.lineOffset;
cursorInfo.primaryPosition.y = cursorInfo.lineOffset;
-
- // Transform the cursor info from line's coords to text's coords.
- cursorInfo.primaryPosition.x += ( LTR == line.direction ) ? 0.f : parameters.visualModel->mControlSize.width;
const bool RTL = true;
const float LINE_SPACING= 0.f;
const bool RTL = true;
const float LINE_SPACING= 0.f;
+inline bool isEmptyLineAtLast( const Vector<LineRun>& lines, const Vector<LineRun>::Iterator& line )
+{
+ return ( (*line).characterRun.numberOfCharacters == 0 && line + 1u == lines.End() );
+}
+
- if( line.characterRun.characterIndex >= lastCharacterPlusOne )
+ if( line.characterRun.characterIndex > lastCharacterPlusOne )
{
// Do not align lines beyond the last laid-out character.
break;
}
{
// Do not align lines beyond the last laid-out character.
break;
}
+ if( line.characterRun.characterIndex == lastCharacterPlusOne && !isEmptyLineAtLast( lines, it ) )
+ {
+ // Do not align lines beyond the last laid-out character unless the line is last and empty.
+ break;
+ }
+
// Calculate the line's alignment offset accordingly with the align option,
// the box width, line length, and the paragraph's direction.
CalculateHorizontalAlignment( size.width,
// Calculate the line's alignment offset accordingly with the align option,
// the box width, line length, and the paragraph's direction.
CalculateHorizontalAlignment( size.width,
if( mImpl->mEventData )
{
mImpl->mEventData->mUpdateAlignment = true;
if( mImpl->mEventData )
{
mImpl->mEventData->mUpdateAlignment = true;
+
+ // Update the cursor if it's in editing mode
+ if( EventData::IsEditingState( mImpl->mEventData->mState ) )
+ {
+ mImpl->ChangeState( EventData::EDITING );
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ }
}
mImpl->RequestRelayout();
}
mImpl->RequestRelayout();