From d0f6bb2e36fa77f9581d7d53fc7479a4b06b883d Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 21 Jul 2016 21:48:21 +0900 Subject: [PATCH] syntax_color: improve macro keywords. Set macro colors to the end of a strcuture, if the define continues to the next lines with line wrapping. --- src/lib/edc_parser.c | 4 ++-- src/lib/syntax_color.c | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/lib/edc_parser.c b/src/lib/edc_parser.c index e82b5f1..ef91473 100644 --- a/src/lib/edc_parser.c +++ b/src/lib/edc_parser.c @@ -2053,7 +2053,7 @@ parser_first_group_name_get(parser_data *pd, Evas_Object *entry) char *slash = strstr(p, "\\"); if (!slash) break; - char *eol = strstr(p, "\n"); + char *eol = strstr(p, EOL); if (!eol) goto end; if (eol < slash) break; @@ -2385,7 +2385,7 @@ parser_group_list_get(parser_data *pd, Evas_Object *entry) char *slash = strstr(p, "\\"); if (!slash) break; - char *eol = strstr(p, "\n"); + char *eol = strstr(p, EOL); if (!eol) goto end; if (eol < slash) break; diff --git a/src/lib/syntax_color.c b/src/lib/syntax_color.c index dc853eb..17d0d5a 100644 --- a/src/lib/syntax_color.c +++ b/src/lib/syntax_color.c @@ -487,9 +487,6 @@ macro_apply(Eina_Strbuf *strbuf, const char **src, int length, char **cur, *prev = *cur; *cur = macro_end; - eina_strbuf_append_length(strbuf, *prev, (*cur - *prev)); - eina_strbuf_append(strbuf, ""); - //push the macro to color table but only not numeric case. if ((macro_end > macro_begin) && ((macro_begin[0] < '0') || (macro_begin[0] > '9'))) @@ -499,6 +496,30 @@ macro_apply(Eina_Strbuf *strbuf, const char **src, int length, char **cur, free(macro); } + //Apply macro color to whole macro area continues to the "\". + while (macro_end < (*src + length)) + { + char *slash = strstr(macro_end, "\\"); + char *eol = strstr(macro_end, EOL); + + if ((!slash && eol) || + ((slash && eol) && (slash > eol))) + { + macro_end = eol; + break; + } + + if (!slash || !eol) break; + if (eol < slash) break; + + macro_end = eol + 1; + } + + *cur = macro_end; + + eina_strbuf_append_length(strbuf, *prev, (*cur - *prev)); + eina_strbuf_append(strbuf, ""); + *prev = *cur; return 1;