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;
-
- // Transform the cursor info from line's coords to text's coords.
- cursorInfo.primaryPosition.x += ( LTR == line.direction ) ? 0.f : parameters.visualModel->mControlSize.width;
}
else
{
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() );
+}
+
} //namespace
/**
continue;
}
- if( line.characterRun.characterIndex >= lastCharacterPlusOne )
+ if( line.characterRun.characterIndex > lastCharacterPlusOne )
{
// 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,
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();