Evas textblock: Fix a bug with ellipsis and word-wrap.

Ellipsis didn't work well with word wrapping textblocks.

SVN revision: 67333
This commit is contained in:
Tom Hacohen 2012-01-19 12:11:44 +00:00
parent 408b4b5a39
commit 7266659814
2 changed files with 24 additions and 3 deletions

View File

@ -3798,9 +3798,23 @@ _layout_par(Ctxt *c)
* char is a whitespace we should remove, so this
* is a wanted cutting point. */
else if (uwrap > it->text_pos + it_len)
wrap = -1; /* Delay the cut in a smart way
i.e use the item_pos as the line_start, because
there's already no cut before*/
{
/* FIXME: Should redo the ellipsis handling.
* If we can do ellipsis, just cut here. */
if (it->format->ellipsis == 1.0)
{
_layout_handle_ellipsis(c, it, i);
ret = 1;
goto end;
}
else
{
/* Delay the cut in a smart way i.e use the
item_pos as the line_start, because
there's already no cut before*/
wrap = -1;
}
}
else
wrap -= it->text_pos; /* Cut here */
}

View File

@ -1238,6 +1238,13 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_size_formatted_get(tb, &w, &h);
fail_if((w > (nw / 2)) || (h != nh));
evas_object_textblock_text_markup_set(tb, "aaaaaaaaaaaaaaaaaa<br/>b");
evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0 wrap=word");
evas_object_textblock_size_native_get(tb, &nw, &nh);
evas_object_resize(tb, nw / 2, nh * 2);
evas_object_textblock_size_formatted_get(tb, &w, &h);
fail_if(w > (nw / 2));
END_TB_TEST();
}
END_TEST