Merge "Fix when deleting with predictive text enabled." into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 20 Aug 2015 13:10:07 +0000 (06:10 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 20 Aug 2015 13:10:07 +0000 (06:10 -0700)
1  2 
dali-toolkit/internal/text/text-controller.cpp

@@@ -329,7 -329,7 +329,7 @@@ bool Controller::RemoveText( int cursor
    DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfChars %d\n",
                   this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfChars );
  
-   if( ! mImpl->IsShowingPlaceholderText() )
+   if( !mImpl->IsShowingPlaceholderText() )
    {
      // Delete at current cursor position
      Vector<Character>& currentText = mImpl->mLogicalModel->mText;
@@@ -785,7 -785,14 +785,14 @@@ void Controller::TextDeletedEvent(
                                                             REORDER );
  
    // Queue a cursor reposition event; this must wait until after DoRelayout()
-   mImpl->mEventData->mScrollAfterDelete = true;
+   if( 0u == mImpl->mLogicalModel->mText.Count() )
+   {
+     mImpl->mEventData->mUpdateCursorPosition = true;
+   }
+   else
+   {
+     mImpl->mEventData->mScrollAfterDelete = true;
+   }
  }
  
  bool Controller::DoRelayout( const Size& size,
@@@ -1160,13 -1167,6 +1167,13 @@@ bool Controller::KeyEvent( const Dali::
        // Menu/Home key behaviour does not allow edit mode to resume like Power key
        // Avoids calling the InsertText() method which can delete selected text
      }
 +    else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
 +    {
 +      // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the imf?) when the predictive text is enabled
 +      // and a character is typed after the type of a upper case latin character.
 +
 +      // Do nothing.
 +    }
      else
      {
        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
@@@ -1646,7 -1646,21 +1653,21 @@@ ImfManager::ImfCallbackData Controller:
      }
      case ImfManager::DELETESURROUNDING:
      {
-       RemoveText( imfEvent.cursorOffset, imfEvent.numberOfChars );
+       update = RemoveText( imfEvent.cursorOffset, imfEvent.numberOfChars );
+       if( update )
+       {
+         if( 0u != mImpl->mLogicalModel->mText.Count() ||
+             !mImpl->IsPlaceholderAvailable() )
+         {
+           mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
+         }
+         else
+         {
+           ShowPlaceholderText();
+           mImpl->mEventData->mUpdateCursorPosition = true;
+         }
+       }
        requestRelayout = true;
        break;
      }