Entry: Fix behaviour of markup filters when setting entry text.
authorTom Hacohen <tom@stosb.com>
Mon, 13 Jul 2015 16:38:45 +0000 (17:38 +0100)
committerTom Hacohen <tom@stosb.com>
Mon, 13 Jul 2015 16:57:50 +0000 (17:57 +0100)
The issue was introduced in 28e6878f7cce36efae1438b5e032eb9c0878016a.
While this is a fix in the sense that it reverts to the previously
defined behaviour (defined both in docs and code), the previous
behaviour was stupid and inconsistent. So now we are back to stupid and
inconsistent.

I can't fix this further, because unfortunately, the fix requires
intrusive changes that are just too dangerous to make this late in the
release cycle. Luckily for us, the issues only surface in a very
specific case that is quite uncommon. In order to trigger the bug you
need to set a very long piece of text on an entry that has text filters
set.

Fixes T2561

@fix

src/lib/elm_entry.c

index 959a636..dda0057 100644 (file)
@@ -2875,7 +2875,7 @@ _elm_entry_elm_container_content_unset(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED,
 }
 
 static void
-_entry_text_append(Evas_Object* obj, const char* entry)
+_entry_text_append(Evas_Object* obj, const char* entry, Eina_Bool set)
 {
    int len = 0;
    if (!entry) return;
@@ -2913,9 +2913,14 @@ _entry_text_append(Evas_Object* obj, const char* entry)
           }
         else
           {
-             /* For the case of text set, append will have similar behaviour
-              * as entry text is cleared first */
-             edje_object_part_text_append(sd->entry_edje, "elm.text", entry);
+             if (set)
+               {
+                  edje_object_part_text_set(sd->entry_edje, "elm.text", entry);
+               }
+             else
+               {
+                  edje_object_part_text_append(sd->entry_edje, "elm.text", entry);
+               }
              eo_do(obj, eo_event_callback_call(ELM_ENTRY_EVENT_TEXT_SET_DONE, NULL));
           }
      }
@@ -2958,7 +2963,7 @@ _elm_entry_elm_layout_text_set(Eo *obj, Elm_Entry_Data *sd, const char *part, co
 
    /* Need to clear the entry first */
    edje_object_part_text_set(sd->entry_edje, "elm.text", "");
-   _entry_text_append(obj, entry);
+   _entry_text_append(obj, entry, EINA_TRUE);
 
    if (len > 0)
      _elm_entry_guide_update(obj, EINA_TRUE);
@@ -3863,7 +3868,7 @@ _elm_entry_entry_append(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *ent
    if (!entry) entry = "";
 
    sd->changed = EINA_TRUE;
-   _entry_text_append(obj, entry);
+   _entry_text_append(obj, entry, EINA_FALSE);
 }
 
 EOLIAN static Eina_Bool