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.cpp;h=ffc8aff38188f15009b13e940bf7fd126148d24f;hp=233e764a8da9a33258c9a66a2ccf14b219d91606;hb=bac344e54e6afa0dced75f338ac7a784b7f13632;hpb=f6cf60941d7fb0f8a746ac7c526be305fc2a5961 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 233e764..ffc8aff 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -34,7 +34,7 @@ namespace { #if defined(DEBUG_ENABLED) - Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS"); + Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Verbose, true, "LOG_TEXT_CONTROLS"); #endif const float MAX_FLOAT = std::numeric_limits::max(); @@ -1210,6 +1210,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ 0 != mImpl->mEventData->mPreEditLength ) { CharacterIndex offset = mImpl->mEventData->mPrimaryCursorPosition - mImpl->mEventData->mPreEditStartPosition; + removedPrevious = RemoveText( -static_cast(offset), mImpl->mEventData->mPreEditLength ); mImpl->mEventData->mPrimaryCursorPosition = mImpl->mEventData->mPreEditStartPosition; @@ -1221,7 +1222,7 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ removedPrevious = RemoveSelectedText(); } - if( ! text.empty() ) + if( !text.empty() ) { // Convert text into UTF-32 utf32Characters.Resize( text.size() ); @@ -1269,22 +1270,24 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ mImpl->mEventData->mPreEditLength = utf32Characters.Count(); mImpl->mEventData->mPreEditFlag = true; - // Add the underline for the pre-edit text. - const GlyphIndex* const charactersToGlyphBuffer = mImpl->mVisualModel->mCharactersToGlyph.Begin(); - const Length* const glyphsPerCharacterBuffer = mImpl->mVisualModel->mGlyphsPerCharacter.Begin(); - - const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mImpl->mEventData->mPreEditStartPosition ); - const CharacterIndex lastPreEditCharacter = mImpl->mEventData->mPreEditStartPosition + ( ( mImpl->mEventData->mPreEditLength > 0u ) ? mImpl->mEventData->mPreEditLength - 1u : 0u ); - const Length numberOfGlyphsLastCharacter = *( glyphsPerCharacterBuffer + lastPreEditCharacter ); - const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + lastPreEditCharacter ) + ( numberOfGlyphsLastCharacter > 1u ? numberOfGlyphsLastCharacter - 1u : 0u ); + if( 0u != mImpl->mVisualModel->mCharactersToGlyph.Count() ) + { + // Add the underline for the pre-edit text. + const GlyphIndex* const charactersToGlyphBuffer = mImpl->mVisualModel->mCharactersToGlyph.Begin(); + const Length* const glyphsPerCharacterBuffer = mImpl->mVisualModel->mGlyphsPerCharacter.Begin(); - GlyphRun underlineRun; - underlineRun.glyphIndex = glyphStart; - underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart; + const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mImpl->mEventData->mPreEditStartPosition ); + const CharacterIndex lastPreEditCharacter = mImpl->mEventData->mPreEditStartPosition + ( ( mImpl->mEventData->mPreEditLength > 0u ) ? mImpl->mEventData->mPreEditLength - 1u : 0u ); + const Length numberOfGlyphsLastCharacter = *( glyphsPerCharacterBuffer + lastPreEditCharacter ); + const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + lastPreEditCharacter ) + ( numberOfGlyphsLastCharacter > 1u ? numberOfGlyphsLastCharacter - 1u : 0u ); - // TODO: At the moment the underline runs are only for pre-edit. - mImpl->mVisualModel->mUnderlineRuns.PushBack( underlineRun ); + GlyphRun underlineRun; + underlineRun.glyphIndex = glyphStart; + underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart; + // TODO: At the moment the underline runs are only for pre-edit. + mImpl->mVisualModel->mUnderlineRuns.PushBack( underlineRun ); + } DALI_LOG_INFO( gLogFilter, Debug::Verbose, "mPreEditStartPosition %d mPreEditLength %d\n", mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength ); } }