Elm entry: Fixed issues with deferred entry inserts and immediate text get.
authorTom Hacohen <tom@stosb.com>
Thu, 5 Jul 2012 13:32:19 +0000 (13:32 +0000)
committerTom Hacohen <tom@stosb.com>
Thu, 5 Jul 2012 13:32:19 +0000 (13:32 +0000)
Thanks to yoz for reporting this.

SVN revision: 73346

src/lib/elm_entry.c

index b8685eb..e987b67 100644 (file)
@@ -2375,7 +2375,7 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
      {
         char *tmpbuf;
         size_t tlen;
-        tlen = wd->append_text_position;
+        tlen = strlen(text);
         tmpbuf = malloc(wd->append_text_len + 1);
         if (!tmpbuf)
           {
@@ -2384,8 +2384,8 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
           }
         memcpy(tmpbuf, text, tlen);
         if (wd->append_text_left)
-          memcpy(tmpbuf + tlen, wd->append_text_left + wd->append_text_position, wd->append_text_len - tlen);
-        tmpbuf[wd->append_text_len + 1] = '\0';
+          memcpy(tmpbuf + tlen, wd->append_text_left + wd->append_text_position, wd->append_text_len - wd->append_text_position);
+        tmpbuf[wd->append_text_len] = '\0';
         eina_stringshare_replace(&wd->text, tmpbuf);
         free(tmpbuf);
      }