Fix for cursor position. 23/79823/1
authorVictor Cebollada <v.cebollada@samsung.com>
Wed, 13 Jul 2016 06:35:29 +0000 (07:35 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Wed, 13 Jul 2016 06:39:42 +0000 (07:39 +0100)
* 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 <v.cebollada@samsung.com>
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller.cpp

index aad550c..0263b64 100644 (file)
@@ -1486,9 +1486,15 @@ void Controller::Impl::RetrieveSelection( std::string& selectedText, bool delete
       Vector<Character>::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;
   }
 }
index 3abcccd..9e1d0dc 100644 (file)
@@ -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: