hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=5ea2c05decbcc18fe555c57ce7d259b8bc54cbfc

commit 5ea2c05decbcc18fe555c57ce7d259b8bc54cbfc
Author: Hermet Park <[email protected]>
Date:   Wed Aug 24 16:40:18 2016 +0900

    edc_editor: fix syntax color issue.
    
    Some cases, the edc editor can't apply syntax color
    when it opens a new edc file.
    
    we can cover this scanerio by trying  syntax color logic again
    until it's succeed.
    
    @T4275
---
 src/lib/edc_editor.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c
index 236f571..85aca85 100644
--- a/src/lib/edc_editor.c
+++ b/src/lib/edc_editor.c
@@ -225,7 +225,7 @@ bracket_highlight(edit_data *ed, Evas_Object *tb)
    evas_textblock_cursor_free(cur1);
 }
 
-static void
+static Eina_Bool
 syntax_color_apply(edit_data *ed, Eina_Bool partial)
 {
    Evas_Object *tb = elm_entry_textblock_get(ed->en_edit);
@@ -240,11 +240,11 @@ syntax_color_apply(edit_data *ed, Eina_Bool partial)
    char *utf8 = (char *) color_cancel(NULL, syntax_color_data_get(ed->sh), 
text,
                                       strlen(text), from_line, to_line, &from,
                                       &to);
-   if (!utf8) return;
+   if (!utf8) return EINA_FALSE;
 
    const char *translated = color_apply(NULL, syntax_color_data_get(ed->sh),
                                         utf8, strlen(utf8), from, to);
-   if (!translated) return;
+   if (!translated) return EINA_FALSE;
 
    /* I'm not sure this will be problem.
       But it can avoid entry_object_text_escaped_set() in Edje.
@@ -255,13 +255,18 @@ syntax_color_apply(edit_data *ed, Eina_Bool partial)
    error_highlight(ed, tb);
    bracket_highlight(ed, tb);
    entry_recover(ed, cursor_pos, sel_cur_begin, sel_cur_end);
+
+   return EINA_TRUE;
 }
 
 static Eina_Bool
 syntax_color_timer_cb(void *data)
 {
    edit_data *ed = data;
-   syntax_color_apply(ed, EINA_TRUE);
+   if (!syntax_color_apply(ed, EINA_TRUE))
+     {
+        return ECORE_CALLBACK_RENEW;
+     }
    ed->syntax_color_timer = NULL;
    return ECORE_CALLBACK_CANCEL;
 }

-- 


Reply via email to