Enlightenment CVS committal

Author  : metrics
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps_error.c 


Log Message:
Don't display all the output in the error dialog box if there is a large
amount as the render time for all the text is extreme and makes e appear
frozen.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps_error.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- e_apps_error.c      3 Nov 2006 06:12:22 -0000       1.18
+++ e_apps_error.c      4 Nov 2006 06:15:59 -0000       1.19
@@ -3,6 +3,8 @@
  */
 #include "e.h"
 
+#define MAX_OUTPUT_CHARACTERS 5000
+
 struct _E_Config_Dialog_Data
 {
    char *label;
@@ -173,7 +175,8 @@
    int i;
    Evas_Object *obj, *os;
    char *text;
-   int tlen;
+   char *trunc_note = _("***The remaining output has been truncated. Save the 
output to view.***\n");
+   int tlen, max_lines;
 
    os = e_widget_framelist_add(evas, _(title), 0);
 
@@ -181,16 +184,34 @@
 
    tlen = 0;
    for (i = 0; lines[i].line != NULL; i++)
-     tlen += lines[i].size + 1;
+     {
+       tlen += lines[i].size + 1;
+       /* When the program output is extraordinarily long, it can cause
+        * significant delays during text rendering. Limit to a fixed
+        * number of characters. */
+       if (tlen > MAX_OUTPUT_CHARACTERS)
+         {
+            tlen -= lines[i].size + 1;
+            tlen += strlen(trunc_note);
+            break;
+         }
+     }
+   max_lines = i;
    text = alloca(tlen + 1);
+
    if (text)
      {
        text[0] = 0;
-       for (i = 0; lines[i].line != NULL; i++)
+       for (i = 0; i < max_lines; i++)
          {
             strcat(text, lines[i].line);
             strcat(text, "\n");
          }
+
+       /* Append the warning about truncated output. */
+       if (lines[max_lines].line != NULL)
+         strcat(text, trunc_note);
+
        e_widget_textblock_plain_set(obj, text);
      }
    e_widget_min_size_set(obj, 240, 120);



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to