Evas textblock: fix case of own_closer in style_set

Looks like it was assumed that an fnode->orig_format always ends with a
'/' character if the fnode is an own_closer.
The problem is that a paragraph separator ("ps" and "br" - the latter in
legacy newline mode) is also an own_closer, but might not have '/' at the
end, so decrementing the length is wrong.

This fixes T2654. The example markup had "br" read as "b", which led to
a mismatch with the "font_weight=Bold" tag. Coincidentally, "ps" was not
affected as there was no matching "p" in the style.

@fix
This commit is contained in:
Daniel Hirt 2015-08-27 18:20:47 +03:00
parent f38fffa576
commit d6b6a73358
1 changed files with 5 additions and 2 deletions

View File

@ -6168,8 +6168,11 @@ _textblock_style_generic_set(Evas_Object *eo_obj, Evas_Textblock_Style *ts,
size_t format_len = eina_stringshare_strlen(fnode->orig_format);
/* Is this safe to use alloca here? Strings might possibly get large */
if (fnode->own_closer)
format_len--;
if (fnode->own_closer &&
(format_len > 0) && (fnode->orig_format[format_len - 1] == '/'))
{
format_len--;
}
match = _textblock_format_node_from_style_tag(o, fnode, fnode->orig_format,
format_len);