From: tasn Date: Tue, 20 Sep 2011 08:05:50 +0000 (+0000) Subject: Evas textblock: Fixed an issue when deleting A from A. X-Git-Tag: accepted/2.0/20130306.225542~242^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5e5700425fec8e0d788f02ec5b36809d3b170fb;p=profile%2Fivi%2Fevas.git Evas textblock: Fixed an issue when deleting A from A. Reported by WooHyun. Thanks a lot, great catch, also told me where and what the issue is exactly. Also added a test to verify this works. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@63493 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 3e00417..060e77d 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -5990,11 +5990,11 @@ _evas_textblock_node_format_remove_matching(Evas_Object_Textblock *o, _evas_textblock_node_format_remove(o, fmt, 0); } /* Find the matching format and pop it, if the matching format - * is out format, i.e the last one, pop and break. */ + * is our format, i.e the last one, pop and break. */ else { - Eina_List *i; - EINA_LIST_FOREACH(formats, i, fnode) + Eina_List *i, *next; + EINA_LIST_FOREACH_SAFE(formats, i, next, fnode) { if (_FORMAT_IS_CLOSER_OF( fnode->orig_format, fstr, fstr_len)) @@ -6003,6 +6003,7 @@ _evas_textblock_node_format_remove_matching(Evas_Object_Textblock *o, formats = eina_list_remove_list(formats, i); _evas_textblock_node_format_remove(o, fnode, 0); _evas_textblock_node_format_remove(o, fmt, 0); + break; } } } diff --git a/src/tests/evas_test_textblock.c b/src/tests/evas_test_textblock.c index d868080..8252109 100644 --- a/src/tests/evas_test_textblock.c +++ b/src/tests/evas_test_textblock.c @@ -884,6 +884,14 @@ START_TEST(evas_textblock_format_removal) fnode = evas_textblock_node_format_next_get(fnode); fail_if (fnode); + /* Remove two pairs with the same name and same positions. */ + evas_object_textblock_text_markup_set(tb, "A"); + evas_textblock_cursor_pos_set(cur, 0); + evas_textblock_cursor_char_delete(cur); + + fnode = evas_textblock_node_format_first_get(tb); + fail_if (fnode); + /* Try to remove a format that doesn't have a pair (with a bad mkup) */ evas_object_textblock_text_markup_set(tb, "abcde"); evas_textblock_cursor_pos_set(cur, 2);