lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev Re: DISP_PARTIAL problem - fixed (patch here)


From: Leonid Pauzner
Subject: lynx-dev Re: DISP_PARTIAL problem - fixed (patch here)
Date: Tue, 2 Jun 1998 04:39:52 +0400 (MSD)

This new patch fix previous problems (in mainloop).


DISP_PARTIAL: introduce separate variables Newline_partial
and NumOfLines_partial, initialize them in mainloop
and sinchronize with Newline later when the reload completed (case NORMAL).
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 the user. We disable partial_display
if requested URL have #fragment, owervise user will see the top page first
(yes, s/he will be moved to #fragment when the download completed,
but only if no scroll keys were pressed before!)
Processing of "END" key changed from MAXINT to real number of lines
in the document (important for display_partial mode). - LP.


diff -u old/htformat.c ./htformat.c
--- old/htformat.c      Sun May 10 20:51:04 1998
+++ ./htformat.c        Tue Jun  2 03:36:06 1998
@@ -579,8 +579,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;
@@ -644,8 +647,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;
@@ -738,8 +744,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        Tue Jun  2 04:27:00 1998
@@ -90,8 +90,6 @@

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

-PUBLIC int Newline = 0; /* HText_pageDisplay() requires it */
-
 PRIVATE document newdoc;
 PRIVATE document curdoc;
 PRIVATE char *traversal_host = NULL;
@@ -187,6 +185,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     
*/
@@ -212,6 +211,7 @@
     BOOLEAN LYSelectPopups_flag = LYSelectPopups;
     BOOLEAN trace_mode_flag = FALSE;
     BOOLEAN forced_HTML_mode = LYforce_HTML_mode;
+    BOOLEAN display_partial_flag = display_partial;
     char cfile[128];
     FILE *cfp;
     char *cp, *toolbar;
@@ -492,6 +492,23 @@
                    LYPermitURL = TRUE;
                }

+#ifdef DISP_PARTIAL
+               display_partial = display_partial_flag; /* reset */
+               Newline_partial = 0;     /* initialize */
+               NumOfLines_partial = 0;  /* initialize */
+               /*
+                *  Disallow display_partial if requested URL have #fragment.
+                *  Overwise user got the document from the first page and
+                *  will be moved to #fragment later after download completed,
+                *  but only if user not messed screen up by scrolling before...
+                *  So fall down to old behavior here.
+                */
+               if (display_partial && (strchr(newdoc.address, '#')==NULL))
+                       display_partial = TRUE;
+               else
+                       display_partial = FALSE;
+#endif /* DISP_PARTIAL */
+
 #ifndef DONT_TRACK_INTERNAL_LINKS
                if (try_internal) {
                    if (newdoc.address &&
@@ -963,6 +980,14 @@
                     *  before, or it is 1 if this is a new file.
                     */
                    Newline = newdoc.line;
+#ifdef DISP_PARTIAL
+                   /*
+                    *  Override newdoc.line value with a new one
+                    *  if user scroll the document while downloading.
+                    */
+                   if (display_partial && (Newline_partial > 0))
+                       Newline = Newline_partial;
+#endid /* DISP_PARTIAL */

                    /*
                     *  If we are going to a target line or
@@ -2303,7 +2328,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]