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.
This commit is contained in:
Hermet Park 2016-07-21 21:48:21 +09:00
parent f18efb732a
commit d0f6bb2e36
2 changed files with 26 additions and 5 deletions

View File

@ -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;

View File

@ -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, "</color>");
//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, "</color>");
*prev = *cur;
return 1;