+static void
+entry_insert_filter(Evas_Object* entry, char* str)
+{
+ if (!entry || !str)
+ return;
+
+ char *insertStr = str;
+ // if entry has text only set then remove item tags
+ if (elm_entry_cnp_textonly_get(entry))
+ {
+ while (EINA_TRUE)
+ {
+ char *startTag = NULL;
+ char *endTag = NULL;
+
+ startTag = strstr(insertStr, "<item");
+ if (!startTag)
+ startTag = strstr(insertStr, "</item");
+ if (startTag)
+ endTag = strstr(startTag, ">");
+ else
+ break;
+ if (!endTag || startTag > endTag)
+ {
+ cnp_debug("Broken tag: %s\n", str);
+ break;
+ }
+
+ size_t sindex = startTag - insertStr;
+ size_t eindex = endTag - insertStr + 1;
+
+ Eina_Strbuf *buf = eina_strbuf_new();
+ if (buf)
+ {
+ eina_strbuf_append(buf, insertStr);
+ eina_strbuf_remove(buf, sindex, eindex);
+ insertStr = eina_strbuf_string_steal(buf);
+ eina_strbuf_free(buf);
+ }
+ }
+ }
+ cnp_debug("remove item tag: %s\n", insertStr);
+
+ // if entry has single line set then remove <br> & <ps> tags
+ if (elm_entry_single_line_get(entry))
+ {
+ Eina_Strbuf *buf = eina_strbuf_new();
+ if (buf)
+ {
+ eina_strbuf_append(buf, insertStr);
+ eina_strbuf_replace_all(buf, "<br>", "");
+ eina_strbuf_replace_all(buf, "<ps>", "");
+ insertStr = eina_strbuf_string_steal(buf);
+ eina_strbuf_free(buf);
+ }
+ }
+ cnp_debug("remove break tag: %s\n", insertStr);
+
+ elm_entry_entry_insert(entry, insertStr);
+
+ if (insertStr != str)
+ free(insertStr);
+}