evas textblock: Fix wrong bidi decision caused by empty text item 03/174403/1
authorYoungbok Shin <youngb.shin@samsung.com>
Sat, 31 Mar 2018 08:01:01 +0000 (17:01 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Mon, 2 Apr 2018 02:28:21 +0000 (02:28 +0000)
An empty text item can be generated in the following squences.

ex) [LATIN]<preedit>[ARAB]</preedit>
1. Create a text item for LATIN script.
2. Create a text item for applying new format stage(<preedit>) to the next text.
3. Create a text item for ARAB script.
=> The text item which is created from #2 will be remained empty.
   And it will have 0 length, LATIN's bidi property and
   same text_pos value with the item which is created from #3.

These empty text item can ruin bidi informations that is working based on text_pos(= cursor's position).

@tizen_fix

Change-Id: Iae219918e3acb1f3c4c6a8eec1f3e12bf77ae00b

src/lib/evas/canvas/evas_object_textblock.c

index 307e5bd..9fff92a 100644 (file)
@@ -10043,9 +10043,24 @@ evas_textblock_cursor_line_char_last(Efl_Text_Cursor_Cursor *cur)
    if (ln->items)
      {
         Evas_Object_Textblock_Item *i;
+        /* TIZEN_ONLY(20180331): Fix wrong bidi decision caused by empty text item
         it = ln->items;
+         */
+        /* END */
         EINA_INLIST_FOREACH(ln->items, i)
           {
+             /* TIZEN_ONLY(20180331): Fix wrong bidi decision caused by empty text item */
+             if ((i->type == EVAS_TEXTBLOCK_ITEM_TEXT) &&
+                 (_ITEM_TEXT(i)->text_props.text_len == 0))
+               continue;
+
+             if (it == NULL)
+               {
+                  it = i;
+                  continue;
+               }
+             /* END */
+
              if (it->text_pos < i->text_pos)
                {
                   it = i;
@@ -12582,6 +12597,13 @@ _efl_canvas_text_efl_text_cursor_cursor_geometry_get(Eo *eo_obj EINA_UNUSED, Efl
                               {
                                  if (ititr == it)
                                    break;
+
+                                 /* TIZEN_ONLY(20180331): Fix wrong bidi decision caused by empty text item */
+                                 if ((ititr->type == EVAS_TEXTBLOCK_ITEM_TEXT) &&
+                                     (_ITEM_TEXT(ititr)->text_props.text_len == 0))
+                                   continue;
+                                 /* END */
+
                                  previt = ititr;
                               }