bug-gv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gv] [bug #24069] Table of Contents not displayed for large docu


From: Bernhard R. Link
Subject: Re: [bug-gv] [bug #24069] Table of Contents not displayed for large documents
Date: Fri, 2 Jan 2009 12:07:44 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

* Markus Steinborn <address@hidden> [090101 20:48]:
> Applied Bernhard's fix to CVS together with a small regression fix. See
> Changelog for more details.

Nice to see this completed.

Testing the File dialog, I sometimes got some hangs and gdb always threw
me in some code that looks like O(n^2) where O(n) should be easily
doable:

Index: src/FileSel.c
===================================================================
RCS file: /sources/gv/gv/src/FileSel.c,v
retrieving revision 1.12
diff -u -r1.12 FileSel.c
--- src/FileSel.c       1 Jan 2009 18:47:17 -0000       1.12
+++ src/FileSel.c       2 Jan 2009 10:50:17 -0000
@@ -1299,7 +1299,7 @@
 {
   int i,e,l;
   USE_Arg(2);
-  char *d,*s;
+  char *d,*s,*p;
 
   BEGINMESSAGE(changeList)
   i=e=l=0;
@@ -1314,12 +1314,17 @@
   d = FS_XtMalloc(e*sizeof(char));
   s[0]='\0';
   i=0;
+  p = s;
   while (i<entries) {
-     strcat(s,list[i]);
-     strcat(s,"\n");
+     size_t len = strlen(list[i]);
+
+     memcpy(p, list[i], len);
+     p += len;
+     *(p++) = '\n';
      d[i]=' ';
-     i++;     
+     i++;
   }
+  *p = '\0';
   d[i]='\0';
 
   RESET_Arg;

The File dialog seems to also need some fine-tuning:

- the scrolling when dragging the window is reversed:
  (when the mouse moves down one, the content scrolls up
   and not down as it did before (though as it is limited
   to whole-item scrolling now it is of course never as
   nice as before)):

Index: src/FileSel.c
===================================================================
RCS file: /sources/gv/gv/src/FileSel.c,v
retrieving revision 1.12
diff -u -r1.12 FileSel.c
--- src/FileSel.c       1 Jan 2009 18:47:17 -0000       1.12
+++ src/FileSel.c       2 Jan 2009 11:00:03 -0000
@@ -1139,7 +1139,7 @@
        if (*nparams>=3) absfactor = atof((char*)(params[2]));
        absfactor = absfactor >= 0 ? (absfactor<=200 ? absfactor : 200) : 0;
        IIMESSAGE1(absfactor,relfactor)
-        if (REVERSE_SCROLLING) { dx = -dx; dy = -dy; }
+        if (REVERSE_SCROLLING) { dx = -dx; } else { dy = -dy; }
        childx = (int) (childx-(dx*absfactor)-(relfactor*childw*dx)/clipw);
        childy = (int) (childy-(dy*absfactor)-(relfactor*childh*dy)/cliph);
        ClipWidgetSetCoordinates(clip,childx,0);

- something in the height computation is flawed. In the font size I have
  here, the last item in the list is only visible by some pixel, but
  seems to be treated as visible. Which means that scrolling by clicking
  in the scroll bar lets the new list start after the no-really-visible
  item (thus effectively hiding every 10th item here. And that scrolling
  to the very end of the list does not shows the very last item (but
  only a few pixel rows not containing a single black pixel). It is
  selectable when clicking there, but when one does not know it is there
  one would not guess so.

- I think there was something else, but I forgot...

Happy new year,
        Bernhard R. Link




reply via email to

[Prev in Thread] Current Thread [Next in Thread]