Evas textblock: Fixed a selection issue.
authorTom Hacohen <tom@stosb.com>
Fri, 8 Feb 2013 15:31:25 +0000 (15:31 +0000)
committerTom Hacohen <tom@stosb.com>
Fri, 8 Feb 2013 15:31:25 +0000 (15:31 +0000)
The issue happens when selecting in strings that have both bidi and different
scripts in the same bidi run. E.g: "עבריתenglishрусскийעברית".

SVN revision: 83786

ChangeLog
NEWS
src/lib/evas/canvas/evas_object_textblock.c
src/tests/evas/evas_test_textblock.c

index 22d4f1c..be15c6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-08  Tom Hacohen (TAsn)
+
+        * Evas textblock: Fixed a selection issue with different scripts and
+       bidi.
+       
 2013-02-08  Guillaume Friloux
         * Fix usage of Ecore_Con_Server's internal buffer.
 
@@ -38,7 +43,6 @@
         * ecore_wayland: Add ecore_wl_globals_get
 
 2013-02-04  Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
-
         * evas: Stop initializing and shutting Fontconfig down
 
 2013-02-04  Cedric Bail
diff --git a/NEWS b/NEWS
index 9c8d939..392cd33 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -158,3 +158,4 @@ Fixes:
     * Fix memleak in Eina_File.
     * Fix ecore_x_screen_is_composited/set() to work on multihead.
     * Fix memory usage of Ecore_Con_Server
+    * Evas textblock: Fixed a selection issue with different scripts and bidi.
index 6ca1c2b..ec8dc45 100644 (file)
@@ -9574,7 +9574,10 @@ _evas_textblock_cursor_range_in_line_geometry_get(
 
         while (it && (it != it2))
           {
-             max_x = it->x + it->adv;
+             if ((start <= it->text_pos) && (it->text_pos <= end))
+               {
+                  max_x = it->x + it->adv;
+               }
              it = (Evas_Object_Textblock_Item *) EINA_INLIST_GET(it)->next;
           }
         if (min_x != max_x)
index 38ed062..2c76c47 100644 (file)
@@ -1381,6 +1381,11 @@ START_TEST(evas_textblock_geometries)
    fail_if((tr->x != tr2->x) || (tr->y != tr2->y) || (tr->w != tr2->w) ||
          (tr->h != tr2->h));
 
+   EINA_LIST_FREE(rects, tr)
+      free(tr);
+   EINA_LIST_FREE(rects2, tr2)
+      free(tr2);
+
    /* Multiline range */
    evas_textblock_cursor_pos_set(cur, 0);
    evas_textblock_cursor_pos_set(main_cur, 14);
@@ -1414,6 +1419,23 @@ START_TEST(evas_textblock_geometries)
    tr2 = eina_list_data_get(eina_list_next(rects));
    fail_if(tr->y >= tr2->y);
 
+   EINA_LIST_FREE(rects, tr)
+      free(tr);
+   EINA_LIST_FREE(rects2, tr2)
+      free(tr2);
+
+   /* Same run different scripts */
+   evas_object_textblock_text_markup_set(tb, "עבריתenglishрусскийעברית");
+
+   evas_textblock_cursor_pos_set(cur, 3);
+   evas_textblock_cursor_pos_set(main_cur, 7);
+   rects = evas_textblock_cursor_range_geometry_get(cur, main_cur);
+
+   fail_if(eina_list_count(rects) != 2);
+
+   EINA_LIST_FREE(rects, tr)
+      free(tr);
+
    END_TB_TEST();
 }
 END_TEST