Evas textblock: Fixed range geometry get in some cases involving rtl.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 30 Jan 2011 10:32:27 +0000 (10:32 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 30 Jan 2011 10:32:27 +0000 (10:32 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@56416 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c

index 475406e..c97e9b5 100644 (file)
@@ -7165,17 +7165,30 @@ _evas_textblock_cursor_range_in_line_geometry_get(
                   return NULL;
                }
 
-             /* This also takes bidi into account because of the positions
-              * in the text are taken into account */
-             if (x2 > x1)
+             /* Make x2 the one on the right */
+             if (x2 < x1)
                {
-                  w = x2 - x1;
-                  x = x1;
+                  Evas_Coord tmp;
+                  tmp = x1;
+                  x1 = x2;
+                  x2 = tmp;
+
+                  tmp = w1;
+                  w1 = w2;
+                  w2 = tmp;
+               }
+
+#ifdef BIDI_SUPPORT
+             if (evas_bidi_is_rtl_char(&ti->bidi_props, 0))
+               {
+                  x = x1 + w1;
+                  w = x2 + w2 - x;
                }
              else
+#endif
                {
-                  w = x1 - x2;
-                  x = x2;
+                  x = x1;
+                  w = x2 - x1;
                }
           }
         else
@@ -7223,7 +7236,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
 #ifdef BIDI_SUPPORT
                   if (evas_bidi_is_rtl_char(&ti->bidi_props, 0))
                     {
-                       w = x;
+                       w = x + w;
                        x = 0;
                     }
                   else
@@ -7284,6 +7297,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
 #ifdef BIDI_SUPPORT
                   if (evas_bidi_is_rtl_char(&ti->bidi_props, 0))
                     {
+                       x += w;
                        w = it2->w - x;
                     }
                   else