From b9f17f467035e33a6c67d81bc8a84d07f215bdc5 Mon Sep 17 00:00:00 2001 From: tasn Date: Thu, 19 Jan 2012 12:11:44 +0000 Subject: [PATCH] Evas textblock: Fix a bug with ellipsis and word-wrap. Ellipsis didn't work well with word wrapping textblocks. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@67333 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_object_textblock.c | 20 +++++++++++++++++--- src/tests/evas_test_textblock.c | 7 +++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 12ca131..568911c 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -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 */ } diff --git a/src/tests/evas_test_textblock.c b/src/tests/evas_test_textblock.c index a820f5c..cf6a78b 100644 --- a/src/tests/evas_test_textblock.c +++ b/src/tests/evas_test_textblock.c @@ -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
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 -- 2.7.4