forked from enlightenment/efl
Evas textblock: Fixed evas_textblock_cursor_geometry_get with the cursor type: EVAS_TEXTBLOCK_CURSOR_BEFORE.
SVN revision: 56414
This commit is contained in:
parent
c6c3ab41e8
commit
62840fe30b
|
@ -6704,7 +6704,6 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
const Evas_Textblock_Cursor *dir_cur;
|
const Evas_Textblock_Cursor *dir_cur;
|
||||||
Evas_Textblock_Cursor cur2;
|
|
||||||
|
|
||||||
dir_cur = cur;
|
dir_cur = cur;
|
||||||
if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
|
if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
|
||||||
|
@ -6713,42 +6712,59 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
|
||||||
}
|
}
|
||||||
else if (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE)
|
else if (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE)
|
||||||
{
|
{
|
||||||
/*FIXME: Rough sketch, not yet implemented - VERY buggy. */
|
|
||||||
/* In the case of a "before cursor", we should get the coordinates
|
/* In the case of a "before cursor", we should get the coordinates
|
||||||
* 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, h, w;
|
Evas_Coord x, y, h, w;
|
||||||
|
Evas_Textblock_Cursor cur2;
|
||||||
|
Evas_Object_Textblock_Node_Format *fmt;
|
||||||
|
|
||||||
|
cur2.obj = cur->obj;
|
||||||
|
evas_textblock_cursor_copy(cur, &cur2);
|
||||||
|
cur2.pos--;
|
||||||
|
fmt = _evas_textblock_cursor_node_format_at_pos_get(&cur2);
|
||||||
|
|
||||||
/* If it's at the end of the line, we want to get the position, not
|
/* If it's at the end of the line, we want to get the position, not
|
||||||
* the position of the previous */
|
* the position of the previous */
|
||||||
if ((cur->pos > 0) && !_evas_textblock_cursor_is_at_the_end(cur))
|
if ((cur->pos > 0) && !_evas_textblock_cursor_is_at_the_end(cur))
|
||||||
|
{
|
||||||
|
Eina_Bool before_char = EINA_FALSE;
|
||||||
|
if (!fmt ||
|
||||||
|
!_IS_LINE_SEPARATOR(eina_strbuf_string_get(fmt->format)))
|
||||||
{
|
{
|
||||||
dir_cur = &cur2;
|
dir_cur = &cur2;
|
||||||
cur2.obj = cur->obj;
|
before_char = EINA_FALSE;
|
||||||
evas_textblock_cursor_copy(cur, &cur2);
|
}
|
||||||
cur2.pos--;
|
else
|
||||||
ret = evas_textblock_cursor_char_geometry_get(&cur2, &x, &y, &w, &h);
|
{
|
||||||
|
before_char = EINA_TRUE;
|
||||||
|
}
|
||||||
|
ret = evas_textblock_cursor_char_geometry_get(
|
||||||
|
dir_cur, &x, &y, &w, &h);
|
||||||
#ifdef BIDI_SUPPORT
|
#ifdef BIDI_SUPPORT
|
||||||
/* Adjust if the char is an rtl char */
|
/* Adjust if the char is an rtl char */
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
Evas_BiDi_Props props;
|
Evas_BiDi_Props props;
|
||||||
props.props = cur2.node->bidi_props;
|
props.props = dir_cur->node->bidi_props;
|
||||||
props.start = 0;
|
props.start = 0;
|
||||||
|
|
||||||
if (evas_bidi_is_rtl_char(&props, cur2.pos))
|
if ((!before_char &&
|
||||||
|
evas_bidi_is_rtl_char(&props, dir_cur->pos)) ||
|
||||||
|
(before_char &&
|
||||||
|
!evas_bidi_is_rtl_char(&props, dir_cur->pos)))
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Just don't advance the width */
|
/* Just don't advance the width */
|
||||||
w = 0;
|
w = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = evas_textblock_cursor_char_geometry_get(cur, &x, &y, &w, &h);
|
ret = evas_textblock_cursor_char_geometry_get(
|
||||||
w = 0;
|
dir_cur, &x, &y, &w, &h);
|
||||||
}
|
}
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue