Evas textblock: Fix selection with bidi text.
authorTom Hacohen <tom@stosb.com>
Wed, 29 Jan 2014 13:25:21 +0000 (13:25 +0000)
committerTom Hacohen <tom@stosb.com>
Wed, 29 Jan 2014 13:27:45 +0000 (13:27 +0000)
This is a regression introduced in
548e548632333f5ef533079a7aaa54aadd20ef8d.

This is really bad, and essentially broke selection geometry for bidi
text. Very serious.

The problematic code assumed that the range comparison for the items
assumed the item marked with 1 is always logically before the item marked
with 2, which is just not true.

src/lib/evas/canvas/evas_object_textblock.c

index 30ebdb4..4ea0e26 100644 (file)
@@ -10136,7 +10136,8 @@ _evas_textblock_cursor_range_in_line_geometry_get(
 
         while (it && (it != it2))
           {
-             if ((it1->text_pos <= it->text_pos) && (it->text_pos <= it2->text_pos))
+             if (((it1->text_pos <= it->text_pos) && (it->text_pos <= it2->text_pos)) ||
+                   ((it2->text_pos <= it->text_pos) && (it->text_pos <= it1->text_pos)))
                {
                   max_x = it->x + it->adv;
                }