edc_editor: rewrite 5ea2c05dec

We found a side effect from that patch. So rewrite it with an other approach.
It's a hackish but no idea except it :(
This commit is contained in:
Hermet Park 2016-08-25 17:22:47 +09:00
parent b3a5acf761
commit a0b9d4e911
1 changed files with 13 additions and 3 deletions

View File

@ -230,6 +230,16 @@ syntax_color_apply(edit_data *ed, Eina_Bool partial)
{
Evas_Object *tb = elm_entry_textblock_get(ed->en_edit);
char *text = (char *) evas_object_textblock_text_markup_get(tb);
int text_len = strlen(text);
//FIXME: We encountered a syntax coloring issue that won't be applied
//at the opening an edc script. The situation condition is below,
//and we try syntax coloring again in that case. Work around logic,
//but it works.
if (text && (text_len == 0))
{
return EINA_FALSE;
}
int from_line = 1;
int to_line = -1;
@ -238,13 +248,13 @@ syntax_color_apply(edit_data *ed, Eina_Bool partial)
char *from = NULL;
char *to = NULL;
char *utf8 = (char *) color_cancel(NULL, syntax_color_data_get(ed->sh), text,
strlen(text), from_line, to_line, &from,
text_len, from_line, to_line, &from,
&to);
if (!utf8) return EINA_FALSE;
if (!utf8) return EINA_TRUE;
const char *translated = color_apply(NULL, syntax_color_data_get(ed->sh),
utf8, strlen(utf8), from, to);
if (!translated) return EINA_FALSE;
if (!translated) return EINA_TRUE;
/* I'm not sure this will be problem.
But it can avoid entry_object_text_escaped_set() in Edje.