Edje entry: Make filter logic consistent across all input methods
authorSubodh Kumar <s7158.kumar@samsung.com>
Tue, 4 Aug 2015 14:32:47 +0000 (15:32 +0100)
committerTom Hacohen <tom@stosb.com>
Tue, 4 Aug 2015 14:35:17 +0000 (15:35 +0100)
Summary:
When commit string comes from key_down text filter is applied before deleting
the range but when commit string comes from imf filter is applied after deleting
the range. Moreover when format is prepended range is deleted before applying
insert filter. Please check the _edje_key_down_cb and
_edje_entry_imf_event_commit_cb  routines.

@fix

Test Plan: Tested in Tizen device

Reviewers: herdsman, thiepha, shilpasingh, raster, tasn

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2904

src/lib/edje/edje_entry.c

index 4a57d56..eab317f 100644 (file)
@@ -207,6 +207,13 @@ _text_filter_markup_prepend_internal(Edje *ed, Entry *en, Evas_Textblock_Cursor
 {
    Edje_Markup_Filter_Callback *cb;
    Eina_List *l;
+   Eina_Bool have_sel = EINA_FALSE;
+
+   if ((clearsel) && (en->have_selection))
+     {
+        _range_del_emit(ed, en->cursor, en->rp->object, en);
+        have_sel = EINA_TRUE;
+     }
 
    EINA_LIST_FOREACH(ed->markup_filter_callbacks, l, cb)
      {
@@ -238,10 +245,12 @@ _text_filter_markup_prepend_internal(Edje *ed, Entry *en, Evas_Textblock_Cursor
                     eina_unicode_utf8_get_len(info->change.insert.content);
                }
           }
-        if ((clearsel) && (en->have_selection))
+        if (have_sel)
           {
-             _range_del_emit(ed, en->cursor, en->rp->object, en);
-             if (info) info->merge = EINA_TRUE;
+            if (info)
+              {
+                 info->merge = EINA_TRUE;
+              }
           }
         if (info)
           info->change.insert.pos =
@@ -266,6 +275,12 @@ _text_filter_text_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c,
    Eina_List *l;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);
+
+   if ((clearsel) && (en->have_selection))
+     {
+        _range_del_emit(ed, en->cursor, en->rp->object, en);
+     }
+
    text2 = strdup(text);
    EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
      {
@@ -383,6 +398,12 @@ _text_filter_markup_prepend(Edje *ed, Entry *en, Evas_Textblock_Cursor *c,
    Eina_List *l;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);
+
+   if ((clearsel) && (en->have_selection))
+     {
+        _range_del_emit(ed, en->cursor, en->rp->object, en);
+     }
+
    text2 = strdup(text);
    EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
      {