fix wrong behaviour of SelectNone() 82/263082/1
authorBowon Ryu <bowon.ryu@samsung.com>
Wed, 25 Aug 2021 11:12:04 +0000 (20:12 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Thu, 26 Aug 2021 02:49:28 +0000 (11:49 +0900)
1. It is wrong behaviour for the cursor position to be 0 when selection is canceled.
Keeping the previous cursor position is the proper behavior.

2. SelectNone() only works if selection is enabled.
In this case, if selection is canceled, EDITING state is more appropriate than INACTIVE.
In INACTIVE, it is difficult to continue editing work, such as the cursor being deactivated.

Change-Id: I0f5f678b3ea205bc334ca9d5cd6e7626f37d8d87
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/text/text-controller-impl-event-handler.cpp

index e24e8aa..d9fedd7 100644 (file)
@@ -708,12 +708,11 @@ void ControllerImplEventHandler::OnSelectNoneEvent(Controller::Impl& impl)
     EventData& eventData = *impl.mEventData;
     if(eventData.mSelectionEnabled && eventData.mState == EventData::SELECTING)
     {
-      eventData.mPrimaryCursorPosition = 0u;
       uint32_t oldStart                = eventData.mLeftSelectionPosition;
       uint32_t oldEnd                  = eventData.mRightSelectionPosition;
 
       eventData.mLeftSelectionPosition = eventData.mRightSelectionPosition = eventData.mPrimaryCursorPosition;
-      impl.ChangeState(EventData::INACTIVE);
+      impl.ChangeState(EventData::EDITING);
       eventData.mUpdateCursorPosition      = true;
       eventData.mUpdateInputStyle          = true;
       eventData.mScrollAfterUpdatePosition = true;