aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2016-07-31 00:48:12 +0300
committerDaniel Hirt <daniel.hirt@samsung.com>2016-07-31 10:33:30 +0300
commit0d9ddc45145cbbac5358d3c3cd343e18ddf11a46 (patch)
tree9637ed3b8e237808fe3c5a2e7bead690f431b373
parentdata for elm - remove misleading and unused Makefile.am (diff)
downloadefl-0d9ddc45145cbbac5358d3c3cd343e18ddf11a46.tar.gz
Canvas text: fix range geometry calculation for RTL
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c27
-rw-r--r--src/tests/evas/evas_test_textblock.c9
2 files changed, 20 insertions, 16 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index da4840e2ca..f06d8760d1 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -11772,6 +11772,14 @@ _evas_textblock_cursor_range_in_line_geometry_get(
return NULL;
}
+#ifdef BIDI_SUPPORT
+ if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL)
+ {
+ x1 = x1 + w1;
+ x2 = x2 + w2;
+ }
+#endif
+
/* Make x2 the one on the right */
if (x2 < x1)
{
@@ -11779,24 +11787,11 @@ _evas_textblock_cursor_range_in_line_geometry_get(
tmp = x1;
x1 = x2;
x2 = tmp;
-
- tmp = w1;
- w1 = w2;
- w2 = tmp;
}
-#ifdef BIDI_SUPPORT
- if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL)
- {
- x = x1 + w1;
- w = x2 + w2 - x;
- }
- else
-#endif
- {
- x = x1;
- w = x2 - x1;
- }
+ x = x1;
+ w = x2 - x1;
+
if (w > 0)
{
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 70ba06bbfe..efee1efd77 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2452,6 +2452,15 @@ START_TEST(evas_textblock_geometries)
free(tr2);
/* Same run different scripts */
+ evas_object_textblock_text_markup_set(tb, "עברית");
+ evas_textblock_cursor_pos_set(main_cur, 4); // last character
+ evas_textblock_cursor_pos_set(cur, 5); // after last character
+
+ rects = evas_textblock_cursor_range_geometry_get(cur, main_cur);
+ fail_if(!rects);
+ EINA_LIST_FREE(rects, tr)
+ free(tr);
+
evas_object_textblock_text_markup_set(tb, "עבריתenglishрусскийעברית");
evas_textblock_cursor_pos_set(cur, 3);