X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-text-updater.cpp;h=35408dafd309e739e29b147f1df1eeb27f5c4033;hp=caf44f7d3ba63b08152614727ea399579905a55e;hb=528ee21711fc507b20ddb031cf6b1d71f1f44e75;hpb=d52cfe949a764d4ab0584b99d1322f06c8acd92f diff --git a/dali-toolkit/internal/text/text-controller-text-updater.cpp b/dali-toolkit/internal/text/text-controller-text-updater.cpp index caf44f7..35408da 100644 --- a/dali-toolkit/internal/text/text-controller-text-updater.cpp +++ b/dali-toolkit/internal/text/text-controller-text-updater.cpp @@ -24,6 +24,8 @@ // INTERNAL INCLUDES #include +#include +#include #include #include #include @@ -91,7 +93,9 @@ void Controller::TextUpdater::SetText(Controller& controller, const std::string& logicalModel->mAnchors, logicalModel->mUnderlinedCharacterRuns, logicalModel->mBackgroundColorRuns, - logicalModel->mStrikethroughCharacterRuns); + logicalModel->mStrikethroughCharacterRuns, + logicalModel->mBoundedParagraphRuns, + logicalModel->mCharacterSpacingCharacterRuns); Length textSize = 0u; const uint8_t* utf8 = NULL; @@ -480,6 +484,7 @@ bool Controller::TextUpdater::RemoveText( ModelPtr& model = impl.mModel; LogicalModelPtr& logicalModel = model->mLogicalModel; + VisualModelPtr& visualModel = model->mVisualModel; DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfCharacters %d\n", &controller, logicalModel->mText.Count(), eventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters); @@ -497,6 +502,25 @@ bool Controller::TextUpdater::RemoveText( cursorIndex = eventData->mPrimaryCursorPosition + cursorOffset; } + //Handle Emoji clustering for cursor handling + // Deletion case: this is handling the deletion cases when the cursor is before or after Emoji + // - Before: when use delete key and cursor is before Emoji (cursorOffset = -1) + // - After: when use backspace key and cursor is after Emoji (cursorOffset = 0) + + const Script script = logicalModel->GetScript(cursorIndex); + if((numberOfCharacters == 1u) && + (IsOneOfEmojiScripts(script))) + { + //TODO: Use this clustering for Emoji cases only. This needs more testing to generalize to all scripts. + CharacterRun emojiClusteredCharacters = RetrieveClusteredCharactersOfCharacterIndex(visualModel, logicalModel, cursorIndex); + Length actualNumberOfCharacters = emojiClusteredCharacters.numberOfCharacters; + + //Set cursorIndex at the first characterIndex of clustred Emoji + cursorIndex = emojiClusteredCharacters.characterIndex; + + numberOfCharacters = actualNumberOfCharacters; + } + if((cursorIndex + numberOfCharacters) > currentText.Count()) { numberOfCharacters = currentText.Count() - cursorIndex;