ESCAPE_VALUE(">", "\x3e"),
};
-
-
/**
* @internal
* Checks if a char is a whitespace.
return EINA_FALSE;
}
+/**
+ * @internal
+ * Returns first occurrence of whitespace character
+ * otherwise return NULL.
+ *
+ * @param[in] string to search.
+ */
+static const char*
+_strchr_whitespace(const char* str)
+{
+ if (!str) return NULL;
+ while (*str && !isspace(*str)) str++;
+ if(*str) return str;
+ return NULL;
+}
+
/**
* @internal
* Parse the format item and populate key and val with the stringshares that
start++; /* Advance after the '=' */
/* If we can find a quote as the first non-space char,
* our new delimiter is a quote, not a space. */
- while (*start == ' ')
+ while (isspace(*start))
start++;
if (*start == '\'')
}
else
{
- end = strchr(start, ' ');
+ end = _strchr_whitespace(start);
while ((end) && (end > start) && (end[-1] == '\\'))
- end = strchr(end + 1, ' ');
+ end = _strchr_whitespace(end + 1);
}
/* Null terminate before the spaces */
* @return the current item parsed from the string.
*/
static const char *
-_format_parse(const char **s)
+_format_parse(const char **s, Eina_Bool all_whitespaces)
{
const char *p;
const char *s1 = NULL, *s2 = NULL;
{
if (!s1)
{
- if (*p != ' ') s1 = p;
+ if (all_whitespaces)
+ {
+ if (!isspace(*p))
+ s1 = p;
+ }
+ else if(*p != ' ')
+ s1 = p;
if (*p == 0) break;
}
else if (!s2)
if ((p > *s) && (p[-1] != '\\') && (!quote))
{
- if (*p == ' ') s2 = p;
+ if (all_whitespaces)
+ {
+ if (isspace(*p))
+ s2 = p;
+ }
+ else if(*p == ' ')
+ s2 = p;
}
if (*p == 0) s2 = p;
}
s = str;
/* get rid of any spaces at the start of the string */
- while (*s == ' ') s++;
+ while (isspace(*s)) s++;
Allocator allocator;
_allocator_init(&allocator);
- while ((item = _format_parse(&s)))
+ while ((item = _format_parse(&s, EINA_TRUE)))
{
const char *key = NULL;
char *val = NULL;
{
fmt = _layout_format_pop(c, n->orig_format);
}
- while ((item = _format_parse(&s)))
+ while ((item = _format_parse(&s, EINA_FALSE)))
{
if (_format_is_param(item))
{
fnode->format_change = EINA_TRUE;
}
- while ((item = _format_parse(&s)))
+ while ((item = _format_parse(&s, EINA_FALSE)))
{
int itlen = s - item;
/* We care about all of the formats even after a - except for
/* Sanitize the string and reject format items, closing '/' marks. */
buf = eina_strbuf_new();
- while ((item = _format_parse(&format)))
+ while ((item = _format_parse(&format, EINA_FALSE)))
{
int itlen = format - item;
/* We care about all of the formats even after a - except for
EFL_START_TEST(efl_text_style)
{
START_EFL_CANVAS_TEXTBLOCK_TEST();
+ Eina_Size2D size1, size2;
int changed_emit = 0;
efl_event_callback_add(txt, EFL_CANVAS_TEXTBLOCK_EVENT_CHANGED, _increment_int_changed, &changed_emit);
efl_text_markup_set(txt, "");
ck_assert_int_eq(changed_emit, 2);
+ // Style Applying
+ efl_text_set(txt,"A");
+ efl_canvas_textblock_style_apply(txt,"\tfont_size=2\t");
+ size1 = efl_canvas_textblock_size_native_get(txt);
+ efl_canvas_textblock_style_apply(txt,"\nfont_size=20\n");
+ size2 = efl_canvas_textblock_size_native_get(txt);
+ ck_assert(size1.w < size2.w);
+ ck_assert(size1.h < size2.h);
+
END_EFL_CANVAS_TEXTBLOCK_TEST();
}
EFL_END_TEST