billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=4b0de53914238b69a7213427aaf67aecb5080cbf

commit 4b0de53914238b69a7213427aaf67aecb5080cbf
Author: Boris Faure <[email protected]>
Date:   Sun Jun 7 21:18:06 2020 +0200

    termiolink: use eina_convert_strtod_c() to avoid issues with $LANG
    
    because it may parse ',' as a separator (in french for example).
    
    + stop parsing forward on ')'
---
 src/bin/termiolink.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index 524e33a..dba8d3c 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -666,8 +666,8 @@ _is_authorized_in_color(const int codepoint)
       case '\t': return EINA_TRUE;
       case ' ': return EINA_TRUE;
       case '#': return EINA_TRUE;
+      case '%': return EINA_TRUE;
       case '(': return EINA_TRUE;
-      case ')': return EINA_TRUE;
       case '+': return EINA_TRUE;
       case ',': return EINA_TRUE;
       case '.': return EINA_TRUE;
@@ -836,7 +836,7 @@ _parse_one_css_rgb_color(struct ty_sb *sb,
    if (!sb->len)
      return EINA_FALSE;
 
-   d = strtod(sb->buf, &endptr_double);
+   d = eina_convert_strtod_c(sb->buf, &endptr_double);
    l = strtol(sb->buf, &endptr_long, 0);
    if (isnan(d) || endptr_double == sb->buf || d < 0 || l < 0)
        return EINA_FALSE;
@@ -883,7 +883,7 @@ _parse_one_css_alpha(struct ty_sb *sb,
    if (!sb->len)
      return EINA_FALSE;
 
-   d = strtod(sb->buf, &endptr_double);
+   d = eina_convert_strtod_c(sb->buf, &endptr_double);
    if (isnan(d) || endptr_double == sb->buf || d < 0)
        return EINA_FALSE;
    ty_sb_lskip(sb, endptr_double - sb->buf);
@@ -1000,7 +1000,7 @@ _parse_css_rgb_color(struct ty_sb *sb,
           return EINA_FALSE;
         ty_sb_spaces_ltrim(sb);
         if (sb->buf[0] != ')')
-          ty_sb_lskip(sb, 1);
+          return EINA_FALSE;
      }
 
    *rp = r;
@@ -1246,23 +1246,17 @@ termio_color_find(const Evas_Object *obj, int cx, int 
cy,
 
         /* Check if the previous char is a delimiter */
         res = _txt_next_at(ty, &new_x2, &new_y2, txt, &txtlen, &codepoint);
-        if ((res != 0) || (txtlen == 0))
-          {
-             goforward = EINA_FALSE;
-             break;
-          }
-
-        if (!_is_authorized_in_color(codepoint))
-          {
-             goforward = EINA_FALSE;
-             break;
-          }
+        if ((res != 0) || (txtlen == 0) ||
+            (!_is_authorized_in_color(codepoint) && (codepoint != ')')))
+          break;
 
         res = ty_sb_add(&sb, txt, txtlen);
         if (res < 0) goto end;
 
         x2 = new_x2;
         y2 = new_y2;
+        if (codepoint == ')')
+          break;
      }
 
    /* colors do not span multiple lines (for the moment) */
@@ -1310,7 +1304,6 @@ termio_color_find(const Evas_Object *obj, int cx, int cy,
      goto end;
 
    found = EINA_TRUE;
-   /* TODO: right trim */
 
 end:
    termpty_backlog_unlock();

-- 


Reply via email to