Evas textblock: Clear unused paragraphs

This fixes a scenario in which paragraphs in the current layout still
store visual lines from the previous layout. This is possible if the
text uses an ellipsis format, allowing the layout work to stop at a
certain paragraph. This inconsistency affects some query functions that
consider lines which may be irrelevant in the current layout.

Test Case: see added test case to evas_suite.

@fix
This commit is contained in:
Daniel Hirt 2015-07-14 14:44:38 +03:00
parent bb6145ba2e
commit 74ad947ded
2 changed files with 21 additions and 1 deletions

View File

@ -5706,7 +5706,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
}
}
/* Mark all the rest of the paragraphs as invisible */
/* Clear the rest of the paragraphs and mark as invisible */
if (c->par)
{
c->par = (Evas_Object_Textblock_Paragraph *)
@ -5714,6 +5714,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
while (c->par)
{
c->par->visible = 0;
_paragraph_clear(c->obj, c->par);
c->par = (Evas_Object_Textblock_Paragraph *)
EINA_INLIST_GET(c->par)->next;
}

View File

@ -1918,6 +1918,25 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_size_formatted_get(tb, &w, NULL);
ck_assert_int_le(w, nw);
{
int bret, ret;
evas_object_textblock_text_markup_set(tb,
"<ellipsis=1.0>aaa<ps>bbb</ellipsis>");
evas_object_resize(tb, 1, 1);
evas_object_textblock_size_formatted_get(tb, NULL, NULL);
evas_textblock_cursor_line_set(cur, 1);
bret = evas_textblock_cursor_pos_get(cur);
evas_object_resize(tb, 500, 500);
evas_object_textblock_size_formatted_get(tb, NULL, NULL);
evas_object_resize(tb, 1, 1);
evas_object_textblock_size_formatted_get(tb, NULL, NULL);
evas_textblock_cursor_line_set(cur, 1);
ret = evas_textblock_cursor_pos_get(cur);
ck_assert_int_eq(bret, ret);
}
END_TB_TEST();
}
END_TEST