greatly improve formatting in ecore_imf_xim.c

SVN revision: 67195
This commit is contained in:
Mike Blumenkrantz 2012-01-14 00:04:16 +00:00
parent 4d56b824d2
commit 0ec8a5dac2
1 changed files with 250 additions and 240 deletions

View File

@ -122,6 +122,7 @@ utf8_offset_to_index(const char *str, int offset)
return index;
}
#endif
static void
@ -458,6 +459,7 @@ add_feedback_attr (Eina_List **attrs,
if (feedback & XIMHighlight)
attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
}
#endif
static void
@ -957,7 +959,8 @@ preedit_draw_callback(XIC xic __UNUSED__,
int i = 0;
preedit_bufs = eina_ustrbuf_new();
if(imf_context_data->preedit_chars) {
if (imf_context_data->preedit_chars)
{
ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars);
if (ret == EINA_FALSE) goto done;
}
@ -970,14 +973,19 @@ preedit_draw_callback(XIC xic __UNUSED__,
free(tmp);
}
if(t == NULL) {
if (t == NULL)
{
/* delete string */
ret = eina_ustrbuf_remove(preedit_bufs,
call_data->chg_first, call_data->chg_length);
} else if(call_data->chg_length == 0) {
}
else if (call_data->chg_length == 0)
{
/* insert string */
ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first);
} else if(call_data->chg_length > 0) {
}
else if (call_data->chg_length > 0)
{
/* replace string */
ret = eina_ustrbuf_remove(preedit_bufs,
call_data->chg_first, call_data->chg_length);
@ -986,12 +994,14 @@ preedit_draw_callback(XIC xic __UNUSED__,
ret = eina_ustrbuf_insert_n(preedit_bufs, new_text,
new_text_length, call_data->chg_first);
if (ret == EINA_FALSE) goto done;
} else {
}
else {
ret = EINA_FALSE;
}
done:
if(ret == EINA_TRUE) {
if (ret == EINA_TRUE)
{
free(imf_context_data->preedit_chars);
imf_context_data->preedit_chars =
eina_ustrbuf_string_steal(preedit_bufs);