summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-02-01 08:13:39 +0000
committerCedric BAIL <cedric.bail@free.fr>2019-02-11 15:41:07 -0800
commita7eb0695b803713f8f8e69d33be0db1effb18da1 (patch)
tree3e7537a6837c3696e6d3582acdc50ed9d0f64de0
parent7b195738957282f20927d94425f0cf51399bfcad (diff)
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.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D7856
-rw-r--r--src/lib/efl/interfaces/efl_ui_format.c7
1 files 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)
38 if (itr[1] == '%') 38 if (itr[1] == '%')
39 { 39 {
40 itr++; 40 itr++;
41 if (ret_type == FORMAT_TYPE_STATIC)
42 ret_type = FORMAT_TYPE_STRING;
41 continue; 43 continue;
42 } 44 }
43 45
@@ -69,7 +71,8 @@ _format_string_check(const char *fmt)
69 } 71 }
70 else 72 else
71 { 73 {
72 ret_type = FORMAT_TYPE_INVALID; 74 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);
75 found = EINA_FALSE;
73 break; 76 break;
74 } 77 }
75 } 78 }
@@ -121,7 +124,7 @@ _default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
121 } 124 }
122 else if (sd->format_type == FORMAT_TYPE_STATIC) 125 else if (sd->format_type == FORMAT_TYPE_STATIC)
123 { 126 {
124 eina_strbuf_append_printf(str, "%s", sd->template); 127 eina_strbuf_append(str, sd->template);
125 } 128 }
126 else 129 else
127 { 130 {