forked from enlightenment/efl
Canvas text: fix corner case in range geometry calc
The trivial case of [pos,pos] (i.e. range of length 0) didn't work if there is a format item in 'pos'. The condition was fixed to not include such items. The reason it was not apparent for text items is that these have further handling in the rest of the code and would've been disposed of. @fix
This commit is contained in:
parent
8fbb6dbbbb
commit
0c23985626
|
@ -11706,7 +11706,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
|
||||||
_ITEM_TEXT(it)->text_props.text_len
|
_ITEM_TEXT(it)->text_props.text_len
|
||||||
: 1;
|
: 1;
|
||||||
if ((!cur1 || (cur1->pos < it->text_pos + item_len)) &&
|
if ((!cur1 || (cur1->pos < it->text_pos + item_len)) &&
|
||||||
(!cur2 || (cur2->pos >= it->text_pos)))
|
(!cur2 || (cur2->pos > it->text_pos)))
|
||||||
{
|
{
|
||||||
if (!it1)
|
if (!it1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2839,6 +2839,15 @@ START_TEST(evas_textblock_geometries)
|
||||||
|
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
|
||||||
|
/* Check trivial case with format items */
|
||||||
|
evas_object_textblock_text_markup_set(tb, "abc<item size=32x32>efg");
|
||||||
|
evas_textblock_cursor_pos_set(cur, 3);
|
||||||
|
evas_textblock_cursor_pos_set(main_cur, 3);
|
||||||
|
it = evas_textblock_cursor_range_simple_geometry_get(cur, main_cur);
|
||||||
|
rects = eina_iterator_container_get(it);
|
||||||
|
ck_assert(!rects);
|
||||||
|
eina_iterator_free(it);
|
||||||
|
|
||||||
END_TB_TEST();
|
END_TB_TEST();
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
Loading…
Reference in New Issue