Evas textblock: Fix bug with removing formats, format removal should stop at 'end' non-inclusive, just like text removal works.

SVN revision: 53068
This commit is contained in:
Tom Hacohen 2010-10-05 16:17:04 +00:00
parent 0896d2b013
commit eddca25d99
1 changed files with 10 additions and 3 deletions

View File

@ -5056,14 +5056,21 @@ _evas_textblock_node_text_adjust_offsets_to_start(Evas_Object_Textblock *o,
int first = 1;
int update_format_node;
size_t pos = 0;
int orig_end;
itr = n->format_node;
if (!itr || (itr->text_node != n)) return EINA_FALSE;
orig_end = end;
if ((end < 0) || ((size_t) end == eina_ustrbuf_length_get(n->unicode)))
{
use_end = 0;
}
else if (end > 0)
{
/* We don't want the last one */
end--;
}
/* If we are not removing the text node, all should stay in this text
* node, otherwise, everything should move to the previous node */
@ -5097,7 +5104,7 @@ _evas_textblock_node_text_adjust_offsets_to_start(Evas_Object_Textblock *o,
}
update_format_node = ((itr == n->format_node) && (new_node != n));
delta = end - pos;
delta = orig_end - pos;
itr->offset -= pos - start;
while (itr && (itr->text_node == n))
@ -5117,7 +5124,7 @@ _evas_textblock_node_text_adjust_offsets_to_start(Evas_Object_Textblock *o,
break;
}
delta = end - pos;
delta = orig_end - pos;
if (!first)
{
last_node->offset = 0;
@ -5179,7 +5186,7 @@ _evas_textblock_node_text_remove_formats_between(Evas_Object_Textblock *o,
int tmp_offset = 0;
/* start is negative when this gets relevant */
if ((offset + start <= 0) && use_end)
if ((offset + start < 0) && use_end)
{
break;
}