forked from enlightenment/efl
evas textblock: return text direction for under cursor in cursor geometry get
Summary: Currently, in cursor geometry get function, the text direction is not returned if cursor is under cursor. This patch fixs it by returning text direction for under cursor. @fix Reviewers: tasn Subscribers: herdsman, cedric Differential Revision: https://phab.enlightenment.org/D1505
This commit is contained in:
parent
7a1dc9b0df
commit
dee98ea248
|
@ -9596,7 +9596,19 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
|
||||||
|
|
||||||
if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
|
if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
|
||||||
{
|
{
|
||||||
|
Evas_Object_Textblock_Line *ln;
|
||||||
|
Evas_Object_Textblock_Item *it;
|
||||||
|
|
||||||
ret = evas_textblock_cursor_pen_geometry_get(cur, cx, cy, cw, ch);
|
ret = evas_textblock_cursor_pen_geometry_get(cur, cx, cy, cw, ch);
|
||||||
|
_find_layout_item_match(cur, &ln, &it);
|
||||||
|
if (ret >= 0)
|
||||||
|
{
|
||||||
|
Evas_BiDi_Direction itdir =
|
||||||
|
(it->type == EVAS_TEXTBLOCK_ITEM_TEXT) ?
|
||||||
|
_ITEM_TEXT(it)->text_props.bidi_dir :
|
||||||
|
_ITEM_FORMAT(it)->bidi_dir;
|
||||||
|
if (dir) *dir = itdir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE)
|
else if (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE)
|
||||||
{
|
{
|
||||||
|
@ -9604,7 +9616,6 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
|
||||||
* of just after the previous char (which in bidi text may not be
|
* of just after the previous char (which in bidi text may not be
|
||||||
* just before the current char). */
|
* just before the current char). */
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
|
|
||||||
Evas_Object_Textblock_Line *ln;
|
Evas_Object_Textblock_Line *ln;
|
||||||
Evas_Object_Textblock_Item *it;
|
Evas_Object_Textblock_Item *it;
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ START_TEST(evas_textblock_cursor)
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
size_t i, len;
|
size_t i, len;
|
||||||
Evas_Coord nw, nh;
|
Evas_Coord nw, nh;
|
||||||
|
Evas_BiDi_Direction dir;
|
||||||
const char *buf = "This is a<br/> test.<ps/>Lets see if this works.<ps/>עוד פסקה.";
|
const char *buf = "This is a<br/> test.<ps/>Lets see if this works.<ps/>עוד פסקה.";
|
||||||
|
|
||||||
/* Walk the textblock using cursor_char_next */
|
/* Walk the textblock using cursor_char_next */
|
||||||
|
@ -420,6 +421,28 @@ START_TEST(evas_textblock_cursor)
|
||||||
fail_if(evas_textblock_cursor_compare(main_cur, cur));
|
fail_if(evas_textblock_cursor_compare(main_cur, cur));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check direction */
|
||||||
|
evas_object_textblock_text_markup_set(tb, "test");
|
||||||
|
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), "test"));
|
||||||
|
dir = EVAS_BIDI_DIRECTION_RTL;
|
||||||
|
evas_textblock_cursor_geometry_get(cur, NULL, NULL, NULL, NULL, &dir,
|
||||||
|
EVAS_TEXTBLOCK_CURSOR_UNDER);
|
||||||
|
fail_if(dir != EVAS_BIDI_DIRECTION_LTR);
|
||||||
|
dir = EVAS_BIDI_DIRECTION_RTL;
|
||||||
|
evas_textblock_cursor_geometry_get(cur, NULL, NULL, NULL, NULL, &dir,
|
||||||
|
EVAS_TEXTBLOCK_CURSOR_BEFORE);
|
||||||
|
fail_if(dir != EVAS_BIDI_DIRECTION_LTR);
|
||||||
|
evas_object_textblock_text_markup_set(tb, "עוד פסקה");
|
||||||
|
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), "עוד פסקה"));
|
||||||
|
dir = EVAS_BIDI_DIRECTION_LTR;
|
||||||
|
evas_textblock_cursor_geometry_get(cur, NULL, NULL, NULL, NULL, &dir,
|
||||||
|
EVAS_TEXTBLOCK_CURSOR_UNDER);
|
||||||
|
fail_if(dir != EVAS_BIDI_DIRECTION_RTL);
|
||||||
|
dir = EVAS_BIDI_DIRECTION_LTR;
|
||||||
|
evas_textblock_cursor_geometry_get(cur, NULL, NULL, NULL, NULL, &dir,
|
||||||
|
EVAS_TEXTBLOCK_CURSOR_BEFORE);
|
||||||
|
fail_if(dir != EVAS_BIDI_DIRECTION_RTL);
|
||||||
|
|
||||||
#ifdef HAVE_FRIBIDI
|
#ifdef HAVE_FRIBIDI
|
||||||
evas_object_textblock_text_markup_set(tb,
|
evas_object_textblock_text_markup_set(tb,
|
||||||
"testנסיוןtestנסיון<ps/>"
|
"testנסיוןtestנסיון<ps/>"
|
||||||
|
|
Loading…
Reference in New Issue