efl/edje_entry: support &, < and > in preedit string

SVN revision: 83575
This commit is contained in:
Jihoon Kim 2013-02-04 00:57:50 +00:00
parent 7cb6b6ebdb
commit 4b1edd906c
3 changed files with 24 additions and 41 deletions

View File

@ -1,3 +1,7 @@
2013-02-04 Jihoon Kim (jihoon)
* edje entry : Support &, < and > in preedit string.
2013-02-02 Chidambar Zinnoury (ilLogict) 2013-02-02 Chidambar Zinnoury (ilLogict)
* Update French translation. * Update French translation.

1
NEWS
View File

@ -92,6 +92,7 @@ Improvements:
* edje entry : Remove ecore_imf_context_cursor_position_set in functions related to selection. * edje entry : Remove ecore_imf_context_cursor_position_set in functions related to selection.
* Translations updates: * Translations updates:
- french. - french.
* edje entry : Support &, < and > in preedit string
Fixes: Fixes:
* Fix a memory leak in ecore_con_dns when using ecore_con_server_connect * Fix a memory leak in ecore_con_dns when using ecore_con_server_connect

View File

@ -3739,11 +3739,16 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
int cursor_pos; int cursor_pos;
int preedit_start_pos, preedit_end_pos; int preedit_start_pos, preedit_end_pos;
char *preedit_string; char *preedit_string;
char *markup_txt = NULL;
char *tagname[] = {"", "preedit", "preedit_sel", "preedit_sel",
"preedit_sub1", "preedit_sub2", "preedit_sub3", "preedit_sub4"};
int i; int i;
size_t preedit_type_size = sizeof(tagname) / sizeof(tagname[0]);
Eina_Bool preedit_end_state = EINA_FALSE; Eina_Bool preedit_end_state = EINA_FALSE;
Eina_List *attrs = NULL, *l = NULL; Eina_List *attrs = NULL, *l = NULL;
Ecore_IMF_Preedit_Attr *attr; Ecore_IMF_Preedit_Attr *attr;
Eina_Strbuf *buf; Eina_Strbuf *buf;
Eina_Strbuf *preedit_attr_str;
if ((!rp)) return; if ((!rp)) return;
@ -3784,49 +3789,22 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
{ {
EINA_LIST_FOREACH(attrs, l, attr) EINA_LIST_FOREACH(attrs, l, attr)
{ {
if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) if (attr->preedit_type > ECORE_IMF_PREEDIT_TYPE_NONE &&
attr->preedit_type <= preedit_type_size)
{ {
eina_strbuf_append(buf, "<preedit>"); preedit_attr_str = eina_strbuf_new();
eina_strbuf_append_n(buf, preedit_string + attr->start_index, if (preedit_attr_str)
attr->end_index - attr->start_index); {
eina_strbuf_append(buf, "</preedit>"); eina_strbuf_append_n(preedit_attr_str, preedit_string + attr->start_index, attr->end_index - attr->start_index);
} markup_txt = evas_textblock_text_utf8_to_markup(NULL, eina_strbuf_string_get(preedit_attr_str));
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2 || if (markup_txt)
attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3) {
{ eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);
eina_strbuf_append(buf, "<preedit_sel>"); free(markup_txt);
eina_strbuf_append_n(buf, preedit_string + attr->start_index, }
attr->end_index - attr->start_index); eina_strbuf_free(preedit_attr_str);
eina_strbuf_append(buf, "</preedit_sel>"); }
}
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4)
{
eina_strbuf_append(buf, "<preedit_sub1>");
eina_strbuf_append_n(buf, preedit_string + attr->start_index,
attr->end_index - attr->start_index);
eina_strbuf_append(buf, "</preedit_sub1>");
}
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB5)
{
eina_strbuf_append(buf, "<preedit_sub2>");
eina_strbuf_append_n(buf, preedit_string + attr->start_index,
attr->end_index - attr->start_index);
eina_strbuf_append(buf, "</preedit_sub2>");
}
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB6)
{
eina_strbuf_append(buf, "<preedit_sub3>");
eina_strbuf_append_n(buf, preedit_string + attr->start_index,
attr->end_index - attr->start_index);
eina_strbuf_append(buf, "</preedit_sub3>");
}
else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB7)
{
eina_strbuf_append(buf, "<preedit_sub4>");
eina_strbuf_append_n(buf, preedit_string + attr->start_index,
attr->end_index - attr->start_index);
eina_strbuf_append(buf, "</preedit_sub4>");
} }
} }
} }