Evas text: Fix last up to pos error return value.
authorTom Hacohen <tom@stosb.com>
Wed, 18 Nov 2015 10:56:48 +0000 (10:56 +0000)
committerTom Hacohen <tom@stosb.com>
Wed, 18 Nov 2015 10:56:48 +0000 (10:56 +0000)
This commit also simplifies the code a (tiny) bit.

This fixes the bug introduced in:
392df9479f816a641fabbf333326bdab4b9cfc28

src/lib/evas/canvas/evas_object_text.c

index 311e28b..f650048 100644 (file)
@@ -271,7 +271,7 @@ _evas_object_text_last_up_to_pos(const Evas_Object *eo_obj,
 {
    Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
    Evas_Object_Text_Item *it;
-   int pos = 0;
+   int pos = -1;
 
 #ifdef BIDI_SUPPORT
    /* Reorder if it's a bidi text */
@@ -301,7 +301,6 @@ _evas_object_text_last_up_to_pos(const Evas_Object *eo_obj,
              x += it->adv;
           }
         eina_list_free(logical_it);
-        return pos;
      }
    else
 #endif
@@ -318,7 +317,7 @@ _evas_object_text_last_up_to_pos(const Evas_Object *eo_obj,
                }
           }
      }
-   return -1;
+   return pos;
 }
 
 static int