lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev DISP_PARTIAL problem - fixed (patch here)


From: Leonid Pauzner
Subject: lynx-dev DISP_PARTIAL problem - fixed (patch here)
Date: Mon, 1 Jun 1998 20:59:08 +0400 (MSD)

This proposed patch solve the folowing problems:

> 1) while retriving a long document, if press "End" once,
> I got the screen reloaded many times (upper-right corner shows "page 40 of 
> 40",
> "page 41 of 41", "page 42 of 42" etc. until the document received completely.
> It is interesting, "z" key have no effect for now
> until the document received completely.
>
> 2) while retriving a document, the screen several times reloaded
> at different scroll positions without pressing any key from my side.
> Yes, after all it returns to the first page, but
> why it scroll here and there before? (I saw it on *some links* only,
> seems we need more investigation...)
>
> Leonid.
>
>
Now the screen reloaded only when necessary (a side effect from this -
total amount of pages in upper-right corner now frozen until
user press any scroll key or download completed).

That is not fixed yet - after completing the download
display page moved to the top of the document (ignoring user scroll if any,
during the downloading). Another problem - documents with URL like
tru_la_la.html#tag - they now pointed to the first page during the download,
but after completing the download they are moved to #tag, as usual.

Leonid.



* DISP_PARTIAL: introduce separate variables Newline_partial
and NumOfLines_partial, initialize them in HTFormat.c,
*should* be sinchronized with Newline when the reload completed
("case NORMAL" in mainloop, currently not fixed yet).
Change the processing of "END" key from MAXINT to real number of lines
in the document (necessary for display_partial mode).
To reduce the CPU usage while downloading, call HText_pageDisplay
only if NumOfLines_partial is in the current display page
or any Scroll key pressed by user. - LP.



diff -u old/htformat.c ./htformat.c
--- old/htformat.c      Sun May 10 20:51:04 1998
+++ ./htformat.c        Mon Jun  1 14:44:40 1998
@@ -503,6 +503,9 @@
     */
     targetClass = *(sink->isa); /* Copy pointers to procedures */

+    Newline_partial = 0;    /* initialize */
+    NumOfLines_partial = 0; /* initialize */
+
     /* Push binary from socket down sink
     **
     ** This operation could be put into a main event loop
@@ -579,8 +582,11 @@
        (*targetClass.put_block)(sink, input_buffer, status);

 #ifdef DISP_PARTIAL
-       if (display_partial)
-           HText_pageDisplay(Newline,"");
+       if (display_partial &&
+               ((Newline_partial + display_lines) > NumOfLines_partial))  {
+           NumOfLines_partial = HText_getNumOfLines();
+           HText_pageDisplay(Newline_partial, "");
+       }
 #endif /* DISP_PARTIAL */

        bytes += status;
@@ -622,6 +628,9 @@
     */
     targetClass = *(sink->isa); /* Copy pointers to procedures */

+    Newline_partial = 0;    /* initialize */
+    NumOfLines_partial = 0; /* initialize */
+
     /* Push binary from socket down sink
     */
     for (;;) {
@@ -644,8 +653,11 @@
        (*targetClass.put_block)(sink, input_buffer, status);

 #ifdef DISP_PARTIAL
-       if (display_partial)
-           HText_pageDisplay(Newline,"");
+       if (display_partial &&
+               ((Newline_partial + display_lines) > NumOfLines_partial))  {
+           NumOfLines_partial = HText_getNumOfLines();
+           HText_pageDisplay(Newline_partial, "");
+       }
 #endif /* DISP_PARTIAL */

        bytes += status;
@@ -710,6 +722,9 @@
     */
     targetClass = *(sink->isa); /* Copy pointers to procedures */

+    Newline_partial = 0;    /* initialize */
+    NumOfLines_partial = 0; /* initialize */
+
     /* read and inflate gzipped file, and push binary down sink
     */
     for (;;) {
@@ -738,8 +753,11 @@
        (*targetClass.put_block)(sink, input_buffer, status);

 #ifdef DISP_PARTIAL
-       if (display_partial)
-           HText_pageDisplay(Newline,"");
+       if (display_partial &&
+               ((Newline_partial + display_lines) > NumOfLines_partial))  {
+           NumOfLines_partial = HText_getNumOfLines();
+           HText_pageDisplay(Newline_partial, "");
+       }
 #endif /* DISP_PARTIAL */

        bytes += status;
diff -u old/http.c ./http.c
--- old/http.c  Sun May 10 20:51:04 1998
+++ ./http.c    Mon Jun  1 13:37:46 1998
@@ -692,8 +692,11 @@
            }
        }
 #ifdef DISP_PARTIAL
+/*  retriving of HTTP headers: never use display_partial mode at this point!
+
        else if (display_partial)
-           HText_pageDisplay(Newline,"");
+           HText_pageDisplay(Newline_partial,"");
+*/
 #endif /* DISP_PARTIAL */

        bytes_already_read += status;
diff -u old/lyglobal.h ./lyglobal.h
--- old/lyglobal.h      Sun May 10 20:51:04 1998
+++ ./lyglobal.h        Sun May 31 16:37:08 1998
@@ -121,7 +121,6 @@
 extern BOOLEAN goto_buffer;     /* TRUE if offering default goto URL */
 extern char *LYRequestTitle;    /* newdoc.title in calls to getfile() */
 extern char *jumpprompt;        /* The default jump statusline prompt */
-extern int Newline;            /* HText_pageDisplay() requires it */
 extern int more;  /* is there more document to display? */
 extern int display_lines; /* number of lines in the display */
 extern int www_search_result;
@@ -253,6 +252,8 @@
                                   * force source dump        */
 extern BOOLEAN no_url_redirection;   /* Don't follow URL redirections */
 extern BOOLEAN display_partial;      /* Display document during download */
+extern int Newline_partial;          /* -//- "current" newline position */
+extern int NumOfLines_partial;       /* -//- "current" number of lines */
 extern char *form_post_data;         /* User data for post form */
 extern char *form_get_data;          /* User data for get form */
 extern char *http_error_file;        /* Place HTTP status code in this file */
diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Sun May 24 23:41:46 1998
+++ ./lymainlo.c        Mon Jun  1 15:22:16 1998
@@ -90,7 +90,8 @@

 PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */

-PUBLIC int Newline = 0; /* HText_pageDisplay() requires it */
+PUBLIC int Newline_partial = 0; /* HText_pageDisplay() requires it */
+PUBLIC int NumOfLines_partial = -1;

 PRIVATE document newdoc;
 PRIVATE document curdoc;
@@ -187,6 +188,7 @@
     int getresult;
     int arrowup = FALSE, show_help = FALSE;
     int lines_in_file = -1;
+    int Newline = 0;
     char prev_target[512];
     char user_input_buffer[1024];
     char *owner_address = NULL;  /* Holds the responsible owner's address     
*/
@@ -276,6 +278,8 @@
     newdoc.internal_link = FALSE;
     newdoc.line = 1;
     newdoc.link = 0;
+    Newline_partial = 0;
+    NumOfLines_partial = 0;

 #ifdef USE_SLANG
     if (TRACE && LYCursesON) {
@@ -2303,7 +2307,7 @@

        case LYK_END:
            if (more) {
-              Newline = MAXINT; /* go to end of file */
+              Newline = lines_in_file - display_lines + 3;  /* go to end of 
file */
               arrowup = TRUE;   /* position on last link */
            } else {
                cmd = LYK_NEXT_PAGE;
diff -u old/lyutils.c ./lyutils.c
--- old/lyutils.c       Sun May 24 23:41:50 1998
+++ ./lyutils.c Mon Jun  1 14:43:36 1998
@@ -2102,35 +2102,37 @@
        switch (keymap[c+1])
        {
        case LYK_PREV_PAGE :
-           if (Newline > 1)
-               Newline -= display_lines ;
+           if (Newline_partial > 1)
+               Newline_partial -= display_lines ;
            break ;
        case LYK_NEXT_PAGE :
            if (HText_canScrollDown())
-               Newline += display_lines ;
+               Newline_partial += display_lines ;
            break ;
        case LYK_UP_TWO :
-           if (Newline > 1)
-               Newline -= 2 ;
+           if (Newline_partial > 1)
+               Newline_partial -= 2 ;
            break ;
        case LYK_DOWN_TWO :
            if (HText_canScrollDown())
-               Newline += 2 ;
+               Newline_partial += 2 ;
            break ;
        case LYK_HOME:
-           if (Newline > 1)
-               Newline = 1;
+           if (Newline_partial > 1)
+               Newline_partial = 1;
            break;
        case LYK_END:
            if (HText_canScrollDown())
-               Newline = MAXINT;
+               Newline_partial = HText_getNumOfLines() - display_lines + 2;
+               /* set "current" value */
            break;
        case LYK_REFRESH :
            break ;
        default :
            return ((int)FALSE) ;
        }
-       HText_pageDisplay(Newline, "");
+       NumOfLines_partial = HText_getNumOfLines();
+       HText_pageDisplay(Newline_partial, "");
     }
 #endif /* DISP_PARTIAL */




reply via email to

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