Evas textblock: Hopefully eliminate all issues with uninit cursors.

SVN revision: 61227
This commit is contained in:
Tom Hacohen 2011-07-11 07:23:12 +00:00
parent 6852dc4971
commit 181eda995a
1 changed files with 13 additions and 2 deletions

View File

@ -6563,6 +6563,11 @@ _evas_textblock_cursors_update_offset(const Evas_Textblock_Cursor *cur,
data->pos += offset;
}
}
else if (!data->node)
{
data->node = o->text_nodes;
data->pos = 0;
}
}
}
}
@ -6612,8 +6617,6 @@ evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *_text)
if (!cur) return 0;
text = eina_unicode_utf8_to_unicode(_text, &len);
o = (Evas_Object_Textblock *)(cur->obj->object_data);
/* Update all the cursors after our position. */
_evas_textblock_cursors_update_offset(cur, cur->node, cur->pos, len);
n = cur->node;
if (n)
@ -6644,6 +6647,11 @@ evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *_text)
fnode = n->format_node;
}
}
else if (o->text_nodes)
{
cur->node = o->text_nodes;
cur->pos = 0;
}
else
{
n = _evas_textblock_node_text_new();
@ -6658,6 +6666,9 @@ evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *_text)
if (fnode && (fnode->text_node == cur->node))
fnode->offset += len;
/* Update all the cursors after our position. */
_evas_textblock_cursors_update_offset(cur, cur->node, cur->pos, len);
_evas_textblock_changed(o, cur->obj);
n->dirty = EINA_TRUE;
free(text);