From 5c517e5b7e15eeb1bc4f4890ee03eb2364c17e01 Mon Sep 17 00:00:00 2001 From: tasn Date: Thu, 28 Jul 2011 08:18:37 +0000 Subject: [PATCH] Elm entry: Fixed a bug with entry_get with big texts. Entry gradually loads big texts. This bug caused entry_get to return the current text in the textblock, and not the text not yet loaded. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@61840 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_entry.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 29d6b3a..f293ff0 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -1913,7 +1913,28 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item) ERR("text=NULL for edje %p, part 'elm.text'", wd->ent); return NULL; } - eina_stringshare_replace(&wd->text, text); + + if (wd->append_text_len > 0) + { + char *tmpbuf; + size_t tlen; + tlen = strlen(text); + tmpbuf = malloc(tlen + wd->append_text_len + 1); + if (!tmpbuf) + { + ERR("Failed to allocate memory for entry's text %p", obj); + return NULL; + } + memcpy(tmpbuf, text, tlen); + memcpy(tmpbuf + tlen, wd->append_text_left, wd->append_text_len); + tmpbuf[tlen + wd->append_text_len] = '\0'; + eina_stringshare_replace(&wd->text, tmpbuf); + free(tmpbuf); + } + else + { + eina_stringshare_replace(&wd->text, text); + } return wd->text; } -- 2.7.4