hermet pushed a commit to branch master.

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

commit 21ed85b72b0c17db177158f41a56d91c630e5db4
Author: taehyub <taehyub....@samsung.com>
Date:   Fri Mar 25 13:18:06 2016 +0900

    syntax_color: improve string syntax color logic
    
    Summary:
    If we input the quotation mark("), the code under the mark are changed to 
gray.
    so I changed the limitation from the start of quotation mark to the end of 
the line.
    
    Test Plan:
    1. launch enventor
    2. input the quotation mark(") in the middle of the code
    3. see the syntax color change range about string syntax color
    
    Reviewers: Jaehyun_Cho, NikaWhite, Hermet
    
    Reviewed By: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D3825
---
 src/lib/syntax_color.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/lib/syntax_color.c b/src/lib/syntax_color.c
index 6285aae..443779d 100644
--- a/src/lib/syntax_color.c
+++ b/src/lib/syntax_color.c
@@ -377,20 +377,32 @@ string_apply(Eina_Strbuf *strbuf, char **cur, char **prev,
              const Eina_Stringshare *col, Eina_Bool inside_string)
 {
    //escape string: " ~ "
-   if (strncmp(*cur, QUOT, QUOT_LEN)) return 0;
+   Eina_Bool is_eol = EINA_FALSE;
+   if (inside_string && !strncmp(*cur, EOL, EOL_LEN)) is_eol = EINA_TRUE;
+   else if (strncmp(*cur, QUOT, QUOT_LEN)) return 0;
 
    char buf[128];
 
    eina_strbuf_append_length(strbuf, *prev, (*cur - *prev));
 
-   if (!inside_string)
-     snprintf(buf, sizeof(buf), "<color=#%s>%s", col, QUOT);
+   // these conditions limit string range to end of line
+   // case 1: this condition checks end of line for string
+   if (is_eol)
+     {
+        snprintf(buf, sizeof(buf), "</color>");
+        eina_strbuf_append(strbuf, buf);
+     }
+   // case 2: this condition checks start and end for string
    else
-     snprintf(buf, sizeof(buf), "%s</color>", QUOT);
-
-   eina_strbuf_append(strbuf, buf);
+     {
+        if (!inside_string)
+          snprintf(buf, sizeof(buf), "<color=#%s>%s", col, QUOT);
+        else
+          snprintf(buf, sizeof(buf), "%s</color>", QUOT);
+          eina_strbuf_append(strbuf, buf);
+          *cur += QUOT_LEN;
+     }
 
-   *cur += QUOT_LEN;
    *prev = *cur;
 
    return 1;

-- 


Reply via email to