hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=27b47b536e7a88ce76c1d92383234f5869f2ac34

commit 27b47b536e7a88ce76c1d92383234f5869f2ac34
Author: ChunEon Park <her...@hermet.pe.kr>
Date:   Wed May 21 10:50:32 2014 +0900

    syntax_color - cutoff "()" from the macro keywords.
---
 src/bin/syntax_color.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/bin/syntax_color.c b/src/bin/syntax_color.c
index 2053d62..6a56f86 100644
--- a/src/bin/syntax_color.c
+++ b/src/bin/syntax_color.c
@@ -155,7 +155,7 @@ color_table_init(color_data *cd)
 }
 
 static void
-macro_key_push(color_data *cd, char *key, int len)
+macro_key_push(color_data *cd, char *str, int len)
 {
    //Already registered?
    Eina_List *l;
@@ -163,9 +163,15 @@ macro_key_push(color_data *cd, char *key, int len)
    EINA_LIST_FOREACH(cd->macros, l, macro)
      {
         if (strlen(macro) != len) continue;
-        if (!strcmp(macro, key)) return;
+        if (!strcmp(macro, str)) return;
      }
 
+   char *key = str;
+
+   //cutoff "()" from the macro name
+   char *cut = strstr(key, "(");
+   if (cut) key = strndup(str, cut - str);
+
    char tmp[2];
    tmp[0] = key[0];
    tmp[1] = '\0';
@@ -184,7 +190,7 @@ macro_key_push(color_data *cd, char *key, int len)
 
    cd->macros = eina_list_append(cd->macros, eina_stringshare_add(tuple->key));
 
-   free(key);
+   if (cut) free(key);
 }
 
 static void
@@ -501,7 +507,10 @@ sharp_apply(Eina_Strbuf *strbuf, const char **src, int 
length, char **cur,
    eina_strbuf_append_length(strbuf, *prev, (*cur - *prev));
    eina_strbuf_append(strbuf, "</color>");
 
-   macro_key_push(cd, strndup(*prev, *cur - *prev), *cur - *prev);
+   //push the macro to color table
+   char *macro = strndup(*prev, *cur - *prev);
+   macro_key_push(cd, macro, *cur - *prev);
+   free(macro);
 
    *prev = *cur;
 

-- 


Reply via email to