From 1144ea312ddadeea2b05c3308235213455655e44 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Thu, 2 May 2013 16:58:58 +0900 Subject: [PATCH] [entry] elm_entry_filter_accept_set now can recognize tags. --- src/lib/elm_entry.c | 59 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index d9deb86..cf5dc1e 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -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; } -- 2.7.4