Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_text_fmt.c Log Message: I hope this solves bug #1 finally =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text_fmt.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ewl_text_fmt.c 20 Aug 2007 18:22:20 -0000 1.6 +++ ewl_text_fmt.c 20 Aug 2007 19:56:43 -0000 1.7 @@ -279,6 +279,15 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("fmt", fmt); + if (idx < fmt->current_node.char_idx) + { + DWARNING("The current position (%u) is higher than the to " + "be to remove position (%u)\n", + fmt->current_node.char_idx, idx); + } + /* adjust the char length, we'll adjust the byte length later */ + fmt->length.char_len -= char_len; + node = ecore_dlist_current(fmt->nodes); while (char_len > 0) { @@ -291,18 +300,28 @@ node->char_len -= available; if (node->char_len > 0) { - node->byte_len = 0; + unsigned int byte_len = 0; + + /* Note: we already removed the related text part + * so it is save to use the new shorter text here */ ewl_text_fmt_char_to_byte(fmt, idx, node->char_len, - NULL, &(node->byte_len)); + NULL, &byte_len); + + /* deduct the byte count */ + fmt->length.byte_len -= node->byte_len - byte_len; + node->byte_len = byte_len; - ecore_dlist_next(fmt->nodes); fmt->current_node.char_idx += node->char_len; fmt->current_node.byte_idx += node->byte_len; + ecore_dlist_next(fmt->nodes); node = ecore_dlist_current(fmt->nodes); } else { + /* we still need to adjust the global byte count */ + fmt->length.byte_len -= node->byte_len; + ecore_dlist_remove(fmt->nodes); ewl_text_fmt_node_free(node); node = ecore_dlist_current(fmt->nodes); @@ -422,8 +441,9 @@ DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("fmt", fmt); - if (fmt->length.char_len != EWL_TEXT(fmt->text)->length.chars) { - DWARNING("The character length of the ftm (%u) is not" + if (fmt->length.char_len != EWL_TEXT(fmt->text)->length.chars) + { + DWARNING("The character length of the fmt (%u) is not" " equal to the length of the text (%u)\n", fmt->length.char_len, EWL_TEXT(fmt->text)->length.chars); ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs