From b7a1bc7849ca5370166ba435a28f443f4bf95a61 Mon Sep 17 00:00:00 2001 From: tasn Date: Mon, 13 Jun 2011 16:04:55 +0000 Subject: [PATCH] Evas textblock: Fixed a rare issue with line wrapping and white stripping. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@60275 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_object_textblock.c | 42 +++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index b8eb4de..3c8e858 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -2570,38 +2570,42 @@ _layout_item_text_split_strip_white(Ctxt *c, { const Eina_Unicode *ts; Evas_Object_Textblock_Text_Item *new_ti = NULL, *white_ti = NULL; - size_t cut2; ts = GET_ITEM_TEXT(ti); - cut2 = cut; - /* Also strip the previous white */ - if ((cut > 1) && _is_white(ts[cut - 1])) - cut--; - - if (!IS_AT_END(ti, cut2) && (ti->text_props.text_len > 0)) + if (!IS_AT_END(ti, cut) && (ti->text_props.text_len > 0)) { new_ti = _layout_text_item_new(c, ti->parent.format); new_ti->parent.text_node = ti->parent.text_node; - new_ti->parent.text_pos = ti->parent.text_pos + cut2; + new_ti->parent.text_pos = ti->parent.text_pos + cut; new_ti->parent.merge = EINA_TRUE; evas_common_text_props_split(&ti->text_props, - &new_ti->text_props, cut2); + &new_ti->text_props, cut); _layout_text_add_logical_item(c, new_ti, lti); } - if ((cut2 > cut) && (ti->text_props.text_len > 0)) + /* Strip the previous white if needed */ + if ((cut >= 1) && _is_white(ts[cut - 1]) && (ti->text_props.text_len > 0)) { - white_ti = _layout_text_item_new(c, ti->parent.format); - white_ti->parent.text_node = ti->parent.text_node; - white_ti->parent.text_pos = ti->parent.text_pos + cut; - white_ti->parent.merge = EINA_TRUE; - white_ti->parent.visually_deleted = EINA_TRUE; + if (cut - 1 > 0) + { + size_t white_cut = cut - 1; + white_ti = _layout_text_item_new(c, ti->parent.format); + white_ti->parent.text_node = ti->parent.text_node; + white_ti->parent.text_pos = ti->parent.text_pos + white_cut; + white_ti->parent.merge = EINA_TRUE; + white_ti->parent.visually_deleted = EINA_TRUE; - evas_common_text_props_split(&ti->text_props, - &white_ti->text_props, cut); - _layout_text_add_logical_item(c, white_ti, lti); + evas_common_text_props_split(&ti->text_props, + &white_ti->text_props, white_cut); + _layout_text_add_logical_item(c, white_ti, lti); + } + else + { + /* Mark this one as the visually deleted. */ + ti->parent.visually_deleted = EINA_TRUE; + } } if (new_ti || white_ti) @@ -3696,7 +3700,7 @@ _layout_par(Ctxt *c) } } - if (!redo_item) + if (!redo_item && !it->visually_deleted) { c->ln->items = (Evas_Object_Textblock_Item *) eina_inlist_append(EINA_INLIST_GET(c->ln->items), -- 2.7.4