From a0b9d4e911ed77fc824b99db40b2ff25af3595c4 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 25 Aug 2016 17:22:47 +0900 Subject: [PATCH] edc_editor: rewrite 5ea2c05decbcc18fe555c57ce7d259b8bc54cbfc We found a side effect from that patch. So rewrite it with an other approach. It's a hackish but no idea except it :( --- src/lib/edc_editor.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c index 85aca85..92a0112 100644 --- a/src/lib/edc_editor.c +++ b/src/lib/edc_editor.c @@ -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.