Reset Preedit variables in 'Delete All' state 03/216803/3
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 1 Nov 2019 08:14:51 +0000 (17:14 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Tue, 5 Nov 2019 01:49:27 +0000 (01:49 +0000)
- If the number of current text and the number of characters to be deleted
 are same, it means all texts should be removed
 and all Preedit variables should be initialized.
 : mPreEditStartPosition and mPreEditLength

Change-Id: I3648925c776251ff03aeb77102e2910e4d09ee33
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali-toolkit/internal/text/text-controller.cpp

index f82eada..9f524dc 100755 (executable)
@@ -3712,6 +3712,17 @@ bool Controller::RemoveText( int cursorOffset,
         }
       }
 
         }
       }
 
+      // If the number of current text and the number of characters to be deleted are same,
+      // it means all texts should be removed and all Preedit variables should be initialized.
+      if( ( currentText.Count() - numberOfCharacters == 0 ) && ( cursorIndex == 0 ) )
+      {
+        if( mImpl->mEventData )
+        {
+          mImpl->mEventData->mPreEditStartPosition = 0;
+          mImpl->mEventData->mPreEditLength = 0;
+        }
+      }
+
       // Updates the text style runs by removing characters. Runs with no characters are removed.
       mImpl->mModel->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
 
       // Updates the text style runs by removing characters. Runs with no characters are removed.
       mImpl->mModel->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );