[4.0] Compare numberOfCharacters to delete all texts 26/163026/2
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 7 Dec 2017 02:43:54 +0000 (11:43 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 11 Dec 2017 01:01:40 +0000 (10:01 +0900)
Change-Id: I408f601f99e76854f47e19ea189b1edb0e8ba05d
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali-toolkit/internal/text/text-controller.cpp

index 5637d0e..367d8e6 100755 (executable)
@@ -45,6 +45,8 @@ namespace
   Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
+const int MAX_NUMBER_OF_CHARACTERS = 200000;
+
 const float MAX_FLOAT = std::numeric_limits<float>::max();
 
 const std::string EMPTY_STRING("");
@@ -3218,6 +3220,9 @@ bool Controller::RemoveText( int cursorOffset,
 {
   bool removed = false;
 
+  // When the users press "Delete All" button, the IME sends numberOfCharacters as '200000' value which means the max number of characters.
+  const bool deleteAll = ( numberOfCharacters >= MAX_NUMBER_OF_CHARACTERS );
+
   if( NULL == mImpl->mEventData )
   {
     return removed;
@@ -3246,7 +3251,7 @@ bool Controller::RemoveText( int cursorOffset,
     }
 
     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 ) )
+        ( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) || deleteAll /*'Delete All' button clicked*/ )
     {
       // Mark the paragraphs to be updated.
       if( Layout::Engine::SINGLE_LINE_BOX == mImpl->mLayoutEngine.GetLayout() )