forked from enlightenment/efl
Canvas text: fix range geometry calculation for RTL
Fixes T3627. @fix
This commit is contained in:
parent
4352747956
commit
0d9ddc4514
|
@ -11772,6 +11772,14 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
return NULL;
|
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 */
|
/* Make x2 the one on the right */
|
||||||
if (x2 < x1)
|
if (x2 < x1)
|
||||||
{
|
{
|
||||||
|
@ -11779,24 +11787,11 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
tmp = x1;
|
tmp = x1;
|
||||||
x1 = x2;
|
x1 = x2;
|
||||||
x2 = tmp;
|
x2 = tmp;
|
||||||
|
|
||||||
tmp = w1;
|
|
||||||
w1 = w2;
|
|
||||||
w2 = tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BIDI_SUPPORT
|
x = x1;
|
||||||
if (ti->text_props.bidi_dir == EVAS_BIDI_DIRECTION_RTL)
|
w = x2 - x1;
|
||||||
{
|
|
||||||
x = x1 + w1;
|
|
||||||
w = x2 + w2 - x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
x = x1;
|
|
||||||
w = x2 - x1;
|
|
||||||
}
|
|
||||||
if (w > 0)
|
if (w > 0)
|
||||||
{
|
{
|
||||||
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
tr = calloc(1, sizeof(Evas_Textblock_Rectangle));
|
||||||
|
|
|
@ -2452,6 +2452,15 @@ START_TEST(evas_textblock_geometries)
|
||||||
free(tr2);
|
free(tr2);
|
||||||
|
|
||||||
/* Same run different scripts */
|
/* 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_object_textblock_text_markup_set(tb, "עבריתenglishрусскийעברית");
|
||||||
|
|
||||||
evas_textblock_cursor_pos_set(cur, 3);
|
evas_textblock_cursor_pos_set(cur, 3);
|
||||||
|
|
Loading…
Reference in New Issue