[entry] elm_entry_filter_accept_set now can recognize tags.
authorWooHyun Jung <wh0705.jung@samsung.com>
Thu, 2 May 2013 07:58:58 +0000 (16:58 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Wed, 12 Jun 2013 04:47:48 +0000 (13:47 +0900)
src/lib/elm_entry.c

index d9deb86..cf5dc1e 100644 (file)
@@ -4915,16 +4915,55 @@ elm_entry_filter_accept_set(void *data,
         int cmp_idx, cmp_char;
         Eina_Bool in_set = EINA_FALSE;
 
-        cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
-        while (cmp_char)
+        if (read_char == '<')
           {
-             if (read_char == cmp_char)
+             while (read_char && (read_char != '>'))
+               read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
+
+             if (goes_in) in_set = EINA_TRUE;
+             else in_set = EINA_FALSE;
+          }
+        else
+          {
+             if (read_char == '&')
                {
-                  in_set = EINA_TRUE;
-                  break;
+                  while (read_char && (read_char != ';'))
+                    read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
+
+                  if (!read_char)
+                    {
+                       if (goes_in) in_set = EINA_TRUE;
+                       else in_set = EINA_FALSE;
+                       goto inserting;
+                    }
+                  if (read_char == ';')
+                    {
+                       char *tag;
+                       tag = malloc(read_idx - last_read_idx + 1);
+                       if (tag)
+                         {
+                            strncpy(tag, (*text) + last_read_idx, read_idx - last_read_idx);
+                            tag[read_idx - last_read_idx] = 0;
+                            read_char = *(elm_entry_markup_to_utf8(tag));
+                            free(tag);
+                         }
+                    }
+               }
+
+             cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
+             while (cmp_char)
+               {
+                  if (read_char == cmp_char)
+                    {
+                       in_set = EINA_TRUE;
+                       break;
+                    }
+                  cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
                }
-             cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
           }
+
+inserting:
+
         if (in_set == goes_in)
           {
              int size = read_idx - last_read_idx;
@@ -4933,8 +4972,12 @@ elm_entry_filter_accept_set(void *data,
                memcpy(insert, *text + last_read_idx, size);
              insert += size;
           }
-        last_read_idx = read_idx;
-        read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
+
+        if (read_char)
+          {
+             last_read_idx = read_idx;
+             read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
+          }
      }
    *insert = 0;
 }