cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a7eb0695b803713f8f8e69d33be0db1effb18da1

commit a7eb0695b803713f8f8e69d33be0db1effb18da1
Author: Jaehyun Cho <jae_hyun....@samsung.com>
Date:   Fri Feb 1 08:13:39 2019 +0000

    efl_ui_format: fix to display %% and unknown format element
    
    This fixes 2 things as follows.
    
    1. Displays format string "%%" as "%".
       Like printf does, "%%" is displayed as "%".
    
    2. Displays unknown format element as it is.
       In format string "(50%)", ")" is an unknown format element.
       Although format string has unknown format element, the format string
       is displayed like printf does.
    
    The cause of the issue displaying "0%" which was mentioned on
    a96933f964b1757b9d9f8a4cce14d883f35a6665 is as follows.
    
    The default format string of progressbar is set as "%.0f%%".
    Therefore, if progressbar's format string is not set, then "%" postfix
    is always displayed.
    
    This commit reverts commit a96933f964b1757b9d9f8a4cce14d883f35a6665.
    This commit restores commit b4112b9735ce75bce95974a257aa1880fa52a6bf.
    This commit restores commit be770d37fb05b8486907796dd16f4635bceb4ce1.
    
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D7856
---
 src/lib/efl/interfaces/efl_ui_format.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_ui_format.c 
b/src/lib/efl/interfaces/efl_ui_format.c
index e722d22654..f6f1b811e2 100644
--- a/src/lib/efl/interfaces/efl_ui_format.c
+++ b/src/lib/efl/interfaces/efl_ui_format.c
@@ -38,6 +38,8 @@ _format_string_check(const char *fmt)
         if (itr[1] == '%')
           {
              itr++;
+             if (ret_type == FORMAT_TYPE_STATIC)
+               ret_type = FORMAT_TYPE_STRING;
              continue;
           }
 
@@ -69,7 +71,8 @@ _format_string_check(const char *fmt)
                     }
                   else
                     {
-                       ret_type = FORMAT_TYPE_INVALID;
+                       ERR("Format string '%s' has unknown format element '%c' 
in format. It must have one format element of type 's', 'f', 'F', 'd', 'u', 
'i', 'o', 'x' or 'X'", fmt, *itr);
+                       found = EINA_FALSE;
                        break;
                     }
                }
@@ -121,7 +124,7 @@ _default_format_cb(void *data, Eina_Strbuf *str, const 
Eina_Value value)
      }
    else if (sd->format_type == FORMAT_TYPE_STATIC)
      {
-        eina_strbuf_append_printf(str, "%s", sd->template);
+        eina_strbuf_append(str, sd->template);
      }
    else
      {

-- 


Reply via email to