forked from enlightenment/efl
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 ona96933f964
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 commita96933f964
. This commit restores commitb4112b9735
. This commit restores commitbe770d37fb
. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D7856
This commit is contained in:
parent
7b19573895
commit
a7eb0695b8
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue