Fixes cursor status when editing with popup or grab handle.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.cpp
index 76e42ca..b5c6161 100644 (file)
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bidirectional-support.h>
 #include <dali-toolkit/internal/text/character-set-conversion.h>
-#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
 #include <dali-toolkit/internal/text/multi-language-support.h>
-#include <dali-toolkit/internal/text/script-run.h>
 #include <dali-toolkit/internal/text/segmentation.h>
 #include <dali-toolkit/internal/text/shaper.h>
-#include <dali-toolkit/internal/text/text-io.h>
-#include <dali-toolkit/internal/text/text-view.h>
 
 namespace
 {
@@ -1004,7 +1000,7 @@ void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart
       mEventData->mDecorator->AddHighlight( xPosition,
                                             offset.y,
                                             xPosition + static_cast<float>( numberOfCharacters ) * glyphAdvance,
-                                            height );
+                                            offset.y + height );
 
       splitStartGlyph = false;
       continue;
@@ -1029,14 +1025,17 @@ void Controller::Impl::RepositionSelectionHandles( CharacterIndex selectionStart
       mEventData->mDecorator->AddHighlight( xPosition,
                                             offset.y,
                                             xPosition + static_cast<float>( interGlyphIndex ) * glyphAdvance,
-                                            height );
+                                            offset.y + height );
 
       splitEndGlyph = false;
       continue;
     }
 
     const float xPosition = position.x - glyph.xBearing + offset.x;
-    mEventData->mDecorator->AddHighlight( xPosition, offset.y, xPosition + glyph.advance, height );
+    mEventData->mDecorator->AddHighlight( xPosition,
+                                          offset.y,
+                                          xPosition + glyph.advance,
+                                          offset.y + height );
   }
 
   CursorInfo primaryCursorInfo;
@@ -1474,7 +1473,7 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical,
     cursorInfo.lineHeight = GetDefaultFontLineHeight();
     cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
 
-    cursorInfo.primaryPosition.x = 1.f;
+    cursorInfo.primaryPosition.x = mEventData->mDecorator->GetCursorWidth();
     cursorInfo.primaryPosition.y = 0.f;
 
     // Nothing else to do.
@@ -1743,7 +1742,7 @@ void Controller::Impl::UpdateCursorPosition()
     {
       case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
       {
-        cursorPosition.x = 1.f;
+        cursorPosition.x = mEventData->mDecorator->GetCursorWidth();
         break;
       }
       case LayoutEngine::HORIZONTAL_ALIGN_CENTER:
@@ -1955,8 +1954,9 @@ void Controller::Impl::ScrollTextToMatchCursor()
   }
 
   // Set which cursors are active according the state.
-  if( ( EventData::EDITING == mEventData->mState ) ||
-      ( EventData::EDITING_WITH_POPUP == mEventData->mState ) ||
+  if( ( EventData::EDITING == mEventData->mState )                  ||
+      ( EventData::EDITING_WITH_POPUP == mEventData->mState )       ||
+      ( EventData::EDITING_WITH_GRAB_HANDLE == mEventData->mState ) ||
       ( EventData::GRAB_HANDLE_PANNING == mEventData->mState ) )
   {
     if( cursorInfo.isSecondaryCursor )