Evas textblock: Better handle visible formats.

Fixed a crash. Thanks WooHyun for making me fix it now. :)

SVN revision: 67790
This commit is contained in:
Tom Hacohen 2012-02-09 12:21:18 +00:00
parent 29c291ff3b
commit 8a1351b5f0
2 changed files with 10 additions and 1 deletions

View File

@ -5690,7 +5690,6 @@ EAPI Eina_Bool
evas_textblock_cursor_is_format(const Evas_Textblock_Cursor *cur)
{
if (!cur || !cur->node) return EINA_FALSE;
if (evas_textblock_cursor_format_is_visible_get(cur)) return EINA_TRUE;
return (_evas_textblock_cursor_node_format_at_pos_get(cur)) ?
EINA_TRUE : EINA_FALSE;
}
@ -8068,6 +8067,7 @@ evas_textblock_cursor_format_is_visible_get(const Evas_Textblock_Cursor *cur)
if (!cur) return EINA_FALSE;
if (!cur->node) return EINA_FALSE;
if (!evas_textblock_cursor_is_format(cur)) return EINA_FALSE;
text = eina_ustrbuf_string_get(cur->node->unicode);
return EVAS_TEXTBLOCK_IS_VISIBLE_FORMAT_CHAR(text[cur->pos]);
}

View File

@ -1283,6 +1283,15 @@ START_TEST(evas_textblock_various)
evas_object_textblock_text_markup_set(tb, "a<ps/>a<ps/>a");
fail_if(!_evas_textblock_check_item_node_link(tb));
/* These shouldn't crash (although the desired outcome is not yet defined) */
evas_object_textblock_text_markup_set(tb, "&#xfffc;");
evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_char_delete(cur);
evas_object_textblock_text_markup_set(tb, "\xEF\xBF\xBC");
evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_char_delete(cur);
END_TB_TEST();
}
END_TEST