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-impl.cpp;h=da7d92943081f54548cc1ab935672d82990d64d1;hp=986c4e56f9197873e9bf27fa40e35c6b14e6aa3f;hb=897c1d5c44231796100a22f0998c30cf675165fc;hpb=660728e83fd72194f53642fd74c09db561f88496 diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 986c4e5..da7d929 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1153,26 +1153,23 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event ) const LineIndex lineIndex = mModel->mVisualModel->GetLineOfCharacter( characterIndex ); const LineIndex previousLineIndex = ( lineIndex > 0 ? lineIndex - 1u : lineIndex ); - if( previousLineIndex >= 0u ) - { - // Retrieve the cursor position info. - CursorInfo cursorInfo; - GetCursorPosition( mEventData->mPrimaryCursorPosition, - cursorInfo ); + // Retrieve the cursor position info. + CursorInfo cursorInfo; + GetCursorPosition( mEventData->mPrimaryCursorPosition, + cursorInfo ); - // Get the line above. - const LineRun& line = *( mModel->mVisualModel->mLines.Begin() + previousLineIndex ); + // Get the line above. + const LineRun& line = *( mModel->mVisualModel->mLines.Begin() + previousLineIndex ); - // Get the next hit 'y' point. - const float hitPointY = cursorInfo.lineOffset - 0.5f * ( line.ascender - line.descender ); + // Get the next hit 'y' point. + const float hitPointY = cursorInfo.lineOffset - 0.5f * ( line.ascender - line.descender ); - // Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index. - mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mModel->mVisualModel, - mModel->mLogicalModel, - mMetrics, - mEventData->mCursorHookPositionX, - hitPointY ); - } + // Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index. + mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mModel->mVisualModel, + mModel->mLogicalModel, + mMetrics, + mEventData->mCursorHookPositionX, + hitPointY ); } else if( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) {