Evas textblock: Fixed invalidate_text_nodes to work with <b><i></b></i>

SVN revision: 61751
This commit is contained in:
Tom Hacohen 2011-07-26 11:47:51 +00:00
parent d042763162
commit fd0bc3b2b1
1 changed files with 33 additions and 4 deletions

View File

@ -3811,24 +3811,53 @@ _format_changes_invalidate_text_nodes(Ctxt *c)
{ {
Evas_Object_Textblock_Node_Format *fnode = c->o->format_nodes; Evas_Object_Textblock_Node_Format *fnode = c->o->format_nodes;
Evas_Object_Textblock_Node_Text *start_n = NULL; Evas_Object_Textblock_Node_Text *start_n = NULL;
Eina_List *fstack = NULL;
int balance = 0; int balance = 0;
while (fnode) while (fnode)
{ {
if (fnode->new) if (fnode->new)
{ {
const char *fstr = fnode->format; const char *fstr = fnode->orig_format;
/* balance < 0 means we gave up and everything should be /* balance < 0 means we gave up and everything should be
* invalidated */ * invalidated */
if (*fstr == '+') if (*fstr == '+')
{ {
balance++; balance++;
if (balance == 1) if (!fstack)
start_n = fnode->text_node; start_n = fnode->text_node;
fstack = eina_list_prepend(fstack, fnode);
} }
else if (*fstr == '-') else if (*fstr == '-')
{ {
balance--; size_t fstr_len;
if (balance == 0) /* Skip the '-' */
fstr++;
fstr_len = strlen(fstr);
/* Generic popper, just pop */
if (((fstr[0] == ' ') && !fstr[1]) || !fstr[0])
{
fstack = eina_list_remove_list(fstack, fstack);
balance--;
}
/* Find the matching format and pop it, if the matching format
* is out format, i.e the last one, pop and break. */
else
{
Eina_List *i;
Evas_Object_Textblock_Node_Format *fnode2;
EINA_LIST_FOREACH(fstack, i, fnode2)
{
if (_FORMAT_IS_CLOSER_OF(
fnode2->orig_format, fstr, fstr_len))
{
fstack = eina_list_remove_list(fstack, i);
balance--;
break;
}
}
}
if (!fstack)
{ {
Evas_Object_Textblock_Node_Text *f_tnode = Evas_Object_Textblock_Node_Text *f_tnode =
fnode->text_node; fnode->text_node;