From 472ec8315d5d49fba794c1ff7f93d1aa0d26ee22 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Wed, 8 Feb 2017 14:33:24 +0000 Subject: [PATCH] Text - Fix for text controller. * Fixes the issue when two or more pre-edit events arrive from the imf manager. The text controller was not able to remove the previous text. Change-Id: I85ba391f6d3c7f5609fbd0ba1b49cb3440059269 Signed-off-by: Victor Cebollada --- dali-toolkit/internal/text/text-controller.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index f10d93e..831fd9c 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1344,16 +1344,17 @@ Vector3 Controller::GetNaturalSize() BIDI_INFO | SHAPE_TEXT | GET_GLYPH_METRICS ); + + // Set the update info to relayout the whole text. + mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; + mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count(); + // Make sure the model is up-to-date before layouting mImpl->UpdateModel( onlyOnceOperations ); // Layout the text for the new width. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT ); - // Set the update info to relayout the whole text. - mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; - mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count(); - // Store the actual control's size to restore later. const Size actualControlSize = mImpl->mModel->mVisualModel->mControlSize; @@ -1416,6 +1417,11 @@ float Controller::GetHeightForWidth( float width ) BIDI_INFO | SHAPE_TEXT | GET_GLYPH_METRICS ); + + // Set the update info to relayout the whole text. + mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; + mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count(); + // Make sure the model is up-to-date before layouting mImpl->UpdateModel( onlyOnceOperations ); @@ -1423,10 +1429,6 @@ float Controller::GetHeightForWidth( float width ) // Layout the text for the new width. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT ); - // Set the update info to relayout the whole text. - mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u; - mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count(); - // Store the actual control's width. const float actualControlWidth = mImpl->mModel->mVisualModel->mControlSize.width; @@ -2459,7 +2461,8 @@ bool Controller::RemoveText( int cursorOffset, numberOfCharacters = currentText.Count() - cursorIndex; } - if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) + if( mImpl->mEventData->mPreEditFlag || // If the preedit flag is enabled, it means two (or more) of them came together i.e. when two keys have been pressed at the same time. + ( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) ) { // Mark the paragraphs to be updated. mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex ); -- 2.7.4