From c156fa43a739e26d4d1ad187848968248078839f Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Wed, 13 Jul 2016 07:35:29 +0100 Subject: [PATCH] Fix for cursor position. * Places the cursor after the last selected character when the 'Copy' button in the text's selection popup is pressed. Change-Id: I77bf8a03eb5e80e37de93e2279c25ea53d93bc43 Signed-off-by: Victor Cebollada --- dali-toolkit/internal/text/text-controller-impl.cpp | 8 +++++++- dali-toolkit/internal/text/text-controller.cpp | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index aad550c..0263b64 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1486,9 +1486,15 @@ void Controller::Impl::RetrieveSelection( std::string& selectedText, bool delete Vector::Iterator last = first + lengthOfSelectedText; utf32Characters.Erase( first, last ); - // Scroll after delete. + // Will show the cursor at the first character of the selection. mEventData->mPrimaryCursorPosition = handlesCrossed ? mEventData->mRightSelectionPosition : mEventData->mLeftSelectionPosition; } + else + { + // Will show the cursor at the last character of the selection. + mEventData->mPrimaryCursorPosition = handlesCrossed ? mEventData->mLeftSelectionPosition : mEventData->mRightSelectionPosition; + } + mEventData->mDecoratorUpdated = true; } } diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 3abcccd..9e1d0dc 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -2570,7 +2570,10 @@ void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Butt case Toolkit::TextSelectionPopup::COPY: { mImpl->SendSelectionToClipboard( false ); // Text not modified - mImpl->RequestRelayout(); // Handles, Selection Highlight, Popup + + mImpl->mEventData->mUpdateCursorPosition = true; + + mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup break; } case Toolkit::TextSelectionPopup::PASTE: -- 2.7.4