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,
mIsPlaceholderPixelSize( false ),
mIsPlaceholderElideEnabled( false ),
mPlaceholderEllipsisFlag( false ),
- mShiftSelectionFlag( true )
+ mShiftSelectionFlag( true ),
+ mUpdateAlignment( false )
{
}
bool mIsPlaceholderElideEnabled : 1; ///< True if the placeholder text's elide is enabled.
bool mPlaceholderEllipsisFlag : 1; ///< True if the text controller sets the placeholder ellipsis.
bool mShiftSelectionFlag : 1; ///< True if the text selection using Shift key is enabled.
+ bool mUpdateAlignment : 1; ///< True if the whole text needs to be full aligned..
};
struct ModifyEvent
// Set the flag to redo the alignment operation.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
+ 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->mModel->mVisualModel->SetTextColor( color );
+ mImpl->mModel->mLogicalModel->mColorRuns.Clear();
+
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | COLOR );
+
mImpl->RequestRelayout();
}
}
// The laid-out lines.
Vector<LineRun>& lines = mImpl->mModel->mVisualModel->mLines;
+ CharacterIndex alignStartIndex = startIndex;
+ Length alignRequestedNumberOfCharacters = requestedNumberOfCharacters;
+
+ // the whole text needs to be full aligned.
+ // If you do not do a full aligned, only the last line of the multiline input is aligned.
+ if( mImpl->mEventData && mImpl->mEventData->mUpdateAlignment )
+ {
+ alignStartIndex = 0u;
+ alignRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
+ mImpl->mEventData->mUpdateAlignment = false;
+ }
+
// Need to align with the control's size as the text may contain lines
// starting either with left to right text or right to left.
mImpl->mLayoutEngine.Align( size,
- startIndex,
- requestedNumberOfCharacters,
+ alignStartIndex,
+ alignRequestedNumberOfCharacters,
mImpl->mModel->mHorizontalAlignment,
lines,
mImpl->mModel->mAlignmentOffset,
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 40;
+const unsigned int TOOLKIT_MICRO_VERSION = 41;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.4.40
+Version: 1.4.41
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT