Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/etox
Dir : e17/libs/etox/src
Modified Files:
etox.c
Log Message:
Fix another bug in etox_append_text, and start fixing up etox_prepend_text.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- etox.c 26 Jul 2003 06:35:21 -0000 1.44
+++ etox.c 26 Jul 2003 07:17:59 -0000 1.45
@@ -206,27 +206,33 @@
for (l = et->lines; l; l = l->next)
end = l->data;
- start = lines->data;
- lines = evas_list_remove(lines, start);
-
/*
- * Need to adjust the length, height, and width of the line to reflect
- * the text that was added.
+ * Merge the last line of the existing text with the first line of the
+ * new text.
*/
- et->length -= end->length;
- et->h -= start->h;
- etox_line_merge(end, start);
- et->length += end->length;
- et->h += start->h;
- if (end->w > et->w)
- et->w = end->w;
-
- while (lines) {
+ if (et->lines) {
start = lines->data;
+ lines = evas_list_remove(lines, start);
/*
- * Now add the remaining lines to the end of the line list.
+ * Need to adjust the length, height, and width of the line to
+ * reflect the text that was added.
*/
+ et->length -= end->length;
+ et->h -= end->h;
+ etox_line_merge(end, start);
+ et->length += end->length;
+ et->h += end->h;
+ if (end->w > et->w)
+ et->w = end->w;
+ }
+
+ /*
+ * Now add the remaining lines to the end of the line list.
+ */
+ while (lines) {
+ start = lines->data;
+
if (start->w > et->w)
et->w = start->w;
@@ -257,9 +263,8 @@
*/
void etox_prepend_text(Etox * et, char *text)
{
- Evas_List *lines, *l, *ll, *lll;
+ Evas_List *lines, *l;
Etox_Line *end = NULL, *start;
- int i;
CHECK_PARAM_POINTER("et", et);
CHECK_PARAM_POINTER("text", text);
@@ -269,47 +274,49 @@
* new text with the last line of the old text.
*/
lines = _etox_break_text(et, text);
+ if (!lines)
+ return;
+
for (l = lines; l; l = l->next)
end = l->data;
- lines = evas_list_remove(lines, end);
- for (i = 0, ll = et->lines; ll; ll = ll->next, i++) {
- if (i == 0) {
- start = ll->data;
-
- } else {
- start = ll->data;
- /*
- * Need to adjust the height and length of the line to reflect
the
- * text that was added.
- */
- et->length -= end->length;
- et->h -= end->h;
- etox_line_merge(end, start);
- et->length += end->length;
- et->h += end->h;
-
- et->lines = evas_list_append(lines, end);
-
- /*
- * Now add the remaining lines to the end of the line list.
- */
- if (start->w > et->w)
- et->w = start->w;
-
- et->h += start->h;
- et->length += start->length;
- lines = evas_list_prepend(lines, start);
- }
+ /*
+ * Merge the first line of the existing text with the last line of the
+ * new text.
+ */
+ if (et->lines) {
+ start = et->lines->data;
+ et->lines = evas_list_remove(et->lines, start);
+
+ /*
+ * Need to adjust the height and length of the line to reflect
+ * the text that was added.
+ */
+ et->length -= end->length;
+ et->h -= end->h;
+ etox_line_merge(end, start);
+ et->length += end->length;
+ et->h += end->h;
+ if (end->w > et->w)
+ et->w = end->w;
}
/*
- * Add the newly created lines to the end of the list of lines.
+ * Now add the remaining lines to the end of the line list.
*/
- for (lll = lines; lll; lll = lll->next) {
- start = lll->data;
- et->lines = evas_list_append(et->lines, start);
+ while (et->lines) {
+ end = et->lines->data;
+
+ if (end->w > et->w)
+ et->w = end->w;
+
+ et->h += end->h;
+ et->length += end->length;
+ lines = evas_list_append(lines, end);
+ et->lines = evas_list_remove(et->lines, end);
}
+
+ et->lines = lines;
/*
* Layout the lines on the etox.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs