elm_entry: if cnp mode is PLAINTEXT, & do not get pasted
authorShilpa Singh <shilpa.singh@samsung.com>
Mon, 11 Dec 2017 02:44:15 +0000 (11:44 +0900)
committerThiep Ha <thiepha@gmail.com>
Mon, 11 Dec 2017 02:44:16 +0000 (11:44 +0900)
Summary:
if cnp mode is PLAINTEXT mode, & do not get pasted issue fix and
conversion(markup to utf8) should happen only for PLAINTEXT mode

Test Plan:
Set PLAINTEXT cnp mode to entry and paste text consisting
of &

Reviewers: thiepha, herdsman

Subscribers: cedric, govi, rajeshps, jpeg

Tags: #efl

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

src/lib/elementary/efl_ui_text.c
src/lib/elementary/elm_entry.c

index 6224676..6077a1f 100644 (file)
@@ -700,11 +700,7 @@ _selection_data_cb(void *data EINA_UNUSED,
         snprintf(entry_tag, len + 1, tag_string, buf);
         _edje_entry_user_insert(obj, entry_tag);
      }
-   else if (sel_data->format & ELM_SEL_FORMAT_MARKUP)
-     {
-        _edje_entry_user_insert(obj, buf);
-     }
-   else
+   else if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
      {
         Efl_Text_Cursor_Cursor *cur, *start, *end;
         efl_ui_text_interactive_selection_cursors_get(obj, &start, &end);
@@ -715,6 +711,10 @@ _selection_data_cb(void *data EINA_UNUSED,
         cur = efl_text_cursor_get(obj, EFL_TEXT_CURSOR_GET_MAIN);
         efl_text_cursor_text_insert(obj, cur, buf);
      }
+   else
+     {
+        _edje_entry_user_insert(obj, buf);
+     }
    free(buf);
 
    return EINA_TRUE;
index b48c4a9..854f234 100644 (file)
@@ -700,11 +700,7 @@ _selection_data_cb(void *data EINA_UNUSED,
         snprintf(entry_tag, len + 1, tag_string, buf);
         _edje_entry_user_insert(obj, entry_tag);
      }
-   else if (sel_data->format & ELM_SEL_FORMAT_MARKUP)
-     {
-        _edje_entry_user_insert(obj, buf);
-     }
-   else
+   else if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
      {
         char *txt = _elm_util_text_to_mkup(buf);
         if (txt)
@@ -717,6 +713,10 @@ _selection_data_cb(void *data EINA_UNUSED,
              ERR("Failed to convert text to markup text!");
           }
      }
+   else
+     {
+        _edje_entry_user_insert(obj, buf);
+     }
    free(buf);
 
    return EINA_TRUE;