forked from enlightenment/efl
Evas textblock: Fixed issues with deleting paragraphs using range_del.
Also added test cases for that. SVN revision: 72398
This commit is contained in:
parent
eefaa4c0fe
commit
b20190232c
|
@ -7666,8 +7666,6 @@ evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_C
|
|||
|
||||
if (n1 == n2)
|
||||
{
|
||||
Evas_Object_Textblock_Node_Format *remove_format = NULL;
|
||||
Evas_Object_Textblock_Node_Text *merge_node = NULL;
|
||||
if ((cur1->pos == 0) &&
|
||||
(cur2->pos == eina_ustrbuf_length_get(n1->unicode)))
|
||||
{
|
||||
|
@ -7681,12 +7679,8 @@ evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_C
|
|||
else
|
||||
{
|
||||
n = _NODE_TEXT(EINA_INLIST_GET(n1)->prev);
|
||||
if (n)
|
||||
{
|
||||
merge_node = n;
|
||||
remove_format = merge_node->format_node;
|
||||
}
|
||||
else
|
||||
/* Short path */
|
||||
if (!n)
|
||||
{
|
||||
/* Clear the whole textblock - do it nicer. */
|
||||
evas_object_textblock_text_markup_set(cur1->obj, "");
|
||||
|
@ -7701,13 +7695,6 @@ evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_C
|
|||
}
|
||||
eina_ustrbuf_remove(n1->unicode, cur1->pos, cur2->pos);
|
||||
_evas_textblock_cursors_update_offset(cur1, cur1->node, cur1->pos, - (cur2->pos - cur1->pos));
|
||||
if (merge_node)
|
||||
{
|
||||
_evas_textblock_node_text_adjust_offsets_to_start(o, n1,
|
||||
0, -1);
|
||||
_evas_textblock_nodes_merge(o, merge_node);
|
||||
evas_textblock_cursor_set_at_format(cur1, remove_format);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1482,6 +1482,24 @@ START_TEST(evas_textblock_editing)
|
|||
evas_textblock_cursor_paragraph_first(cur);
|
||||
fail_if(evas_textblock_cursor_paragraph_next(cur));
|
||||
|
||||
{
|
||||
/* Limit to 1000 iterations so we'll never get into an infinite loop,
|
||||
* even if broken */
|
||||
int limit = 1000;
|
||||
evas_object_textblock_text_markup_set(tb, "this is a test eauoeuaou<ps/>this is a test1<ps/>this is a test 3");
|
||||
evas_textblock_cursor_paragraph_last(cur);
|
||||
while (evas_textblock_cursor_pos_get(cur) > 0)
|
||||
{
|
||||
limit--;
|
||||
fail_if(limit <= 0);
|
||||
evas_textblock_cursor_copy(cur, main_cur);
|
||||
evas_textblock_cursor_char_prev(cur);
|
||||
evas_textblock_cursor_word_start(cur);
|
||||
evas_textblock_cursor_range_delete(cur, main_cur);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Insert illegal characters inside the format. */
|
||||
{
|
||||
const char *content;
|
||||
|
|
Loading…
Reference in New Issue