hermet pushed a commit to branch master.

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

commit c188b78c069161cf43838b7fa4a5ecfc309eab34
Author: ChunEon Park <her...@hermet.pe.kr>
Date:   Thu Jul 9 19:51:19 2015 +0900

    syntax_color: improve logic.
    
    previous code was strictly only working for edc.
    relax the logic to cover more general cases.
---
 src/lib/syntax_color.c | 50 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/src/lib/syntax_color.c b/src/lib/syntax_color.c
index ac0f47e..9c348c8 100644
--- a/src/lib/syntax_color.c
+++ b/src/lib/syntax_color.c
@@ -510,25 +510,31 @@ color_cancel(color_data *cd, const char *src, int length, 
int from_pos,
 
    while (cur && (cur <= (src + length)))
      {
+        //Capture start line
         if (find_from && (line == from_pos))
           {
              from_pos = eina_strbuf_length_get(strbuf);
              find_from = EINA_FALSE;
           }
-        if (find_to && (line == to_pos))
-          {
-             to_pos = eina_strbuf_length_get(strbuf);
-             find_to = EINA_FALSE;
-          }
+
         if (*cur == '<')
           {
              //escape EOL: <br/>
              if (!strncmp(cur, EOL, EOL_LEN))
                {
-                  eina_strbuf_append_length(strbuf, prev, (cur - prev + 
EOL_LEN));
+                  //Capture end line
+                  if (find_to && (line == to_pos))
+                    {
+                       to_pos = eina_strbuf_length_get(strbuf);
+                       find_to = EINA_FALSE;
+                    }
+
+                  eina_strbuf_append_length(strbuf, prev,
+                                            (cur - prev + EOL_LEN));
                   cur += EOL_LEN;
                   prev = cur;
                   line++;
+
                   continue;
                }
              //escape TAB: <tab/>
@@ -537,13 +543,20 @@ color_cancel(color_data *cd, const char *src, int length, 
int from_pos,
                   cur += TAB_LEN;
                   continue;
                }
-            //escape markups: <..> ~ </..>
-            if (markup_skip(strbuf, &src, length, &cur, &prev) == 1)
-              continue;
+             //escape markups: <..> ~ </..>
+             if (markup_skip(strbuf, &src, length, &cur, &prev) == 1)
+               continue;
           }
         cur++;
      }
 
+   //Capture end line
+   if (find_to && (line == to_pos))
+     {
+        to_pos = eina_strbuf_length_get(strbuf);
+        find_to = EINA_FALSE;
+     }
+
    //Same with origin source.
    if (prev == src)
      str = src;
@@ -601,7 +614,7 @@ static int
 color_markup_insert(Eina_Strbuf *strbuf, const char **src, int length, char 
**cur,
                     char **prev, color_data *cd)
 {
-   const char *SYMBOLS = " {}[];:.()!<>=&|";
+   const char *SYMBOLS = " {}[];:.()!<>=&|/";
    Eina_Bool symbol = EINA_FALSE;
 
    if (strchr(SYMBOLS, (*cur)[0])) symbol = EINA_TRUE;
@@ -874,6 +887,23 @@ color_apply(color_data *cd, const char *src, int length, 
char *from, char *to)
              continue;
           }
 
+        if (*cur == '<')
+          {
+             //escape EOL: <br/>
+             if (!strncmp(cur, EOL, EOL_LEN))
+               {
+                  cur += EOL_LEN;
+                  continue;
+               }
+
+             //escape TAB: <tab/>
+             if (!strncmp(cur, TAB, TAB_LEN))
+               {
+                  cur += TAB_LEN;
+                  continue;
+               }
+          }
+
         //handle comment: /* ~ */
         ret = comment_apply(strbuf, &src, length, &cur, &prev, cd->col_comment,
                             &inside_comment);

-- 


Reply via email to