From 06fb50a6809ec527693a9a2f13852d650d106c15 Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 16 Mar 2010 00:56:11 +0000 Subject: [PATCH] bug-- git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@47266 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_object_textblock.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index b35050d..ff617f4 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -3875,6 +3875,9 @@ evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur, const char *for } else if (nc->type == NODE_TEXT) { + int len; + + len = eina_strbuf_length_get(nc->text); if (cur->pos == 0) o->nodes = (Evas_Object_Textblock_Node *)eina_inlist_prepend_relative(EINA_INLIST_GET(o->nodes), EINA_INLIST_GET(n), @@ -3883,24 +3886,35 @@ evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur, const char *for o->nodes = (Evas_Object_Textblock_Node *)eina_inlist_append_relative(EINA_INLIST_GET(o->nodes), EINA_INLIST_GET(n), EINA_INLIST_GET(nc)); - if ((cur->pos <= eina_strbuf_length_get(nc->text)) && (cur->pos != 0)) + if ((cur->pos < len) && (cur->pos != 0)) { n2 = calloc(1, sizeof(Evas_Object_Textblock_Node)); n2->type = NODE_TEXT; n2->text = eina_strbuf_new(); - eina_strbuf_append(n2->text, (eina_strbuf_string_get(nc->text) + cur->pos)); + eina_strbuf_append(n2->text, + (eina_strbuf_string_get(nc->text) + cur->pos)); o->nodes = (Evas_Object_Textblock_Node *)eina_inlist_append_relative(EINA_INLIST_GET(o->nodes), EINA_INLIST_GET(n2), EINA_INLIST_GET(n)); - eina_strbuf_remove(nc->text, cur->pos, eina_strbuf_length_get(nc->text)); cur->node = n2; cur->pos = 0; + cur->eol = 0; + } + else if (cur->pos == len) + { + if (EINA_INLIST_GET(n)->next) + cur->node = EINA_INLIST_GET(n)->next; + else + cur->node = n; + cur->pos = 0; + cur->eol = 0; } else { cur->node = nc; cur->pos = 0; + cur->eol = 0; } } o->formatted.valid = 0; -- 2.7.4