lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV Partial Display


From: Sinan Kaan Yerli
Subject: Re: LYNX-DEV Partial Display
Date: Mon, 30 Mar 1998 12:12:21 +0100 (BST)

On Sun, 29 Mar 1998, Wayne Buttles wrote:

>[ ...]
>I didn't want to let it drop, however, without making sure the issue was
>settled.  I repatched the original code offered by
>address@hidden
><http://www.flora.org/lynx-dev/html/month1096/msg00014.html> to work with
>2.8.1dev and offer it here.  The code is rusty and needs work for both
>correctness and usefullness since it is still in its original form.  The
>real test is just to compile it in, fire up a REALLY long page, and hit
>the space bar.

I was impressed by the simplicity of this patch and then I decided to
spend some time on improving it (I think this way the day I was waiting 
to contribute; "everyone can contribute to Lynx, we just need proper
guiding in the code")... and here is what I've got, presenting
to your judgement (do we really need _continious_ display or not):

* patch aganist http://www.slcc.edu/lynx/current/lynx2.8.1dev.5.tar.gz
* diff -c -r lynx2-8/ lynx2-8.new/
* as it was said before, in the days of multiple-bookmarks patches,
  "I am not an expert on C, but I can read/write C, just about to
  contribute to the code".

What does it do:
* when you activate a page the rendered HTML content will be displayed
  while it is downloading the page _without_ requiring any keyboard
  interrupts (PAGE_DOWN/UP/etc) to start displaying the buffer.
* when you _do_ interrupt with PAGE_UP/PAGE_DOWN/UP_2/DOWN_2/HOME/END
  it will _still_ continue downloading but let you _view_ that part of the 
  *input_buffer* you want to go.

Disadvantages:
* It will certainly slow down the transfer a bit (especially when you try
  to sync the PAGE_DOWN with the tranfer):
  read_a_block_data() --> [*] ------------------------> go_back_to_main()
                           |                            ^
                           +--> render() & display() ---+
* When the transfer finishes, it has to re-render whole page and probably
  do a clear()/erase(), which can be annoying for short files.

Due to limited test (+ complex structure of Lynx):
* Please consider this as a pro-beta patch.
* Only tested on: "uname -a" gives ...
  SunOS star 5.5 Generic_103093-17 sun4m sparc SUNW,SPARCstation-10
* No VMS/DOS patch -or- check, sorry.
* It needs a configure option '--enable-partial' (and maybe a command
  line option).
* Memory leaks?
* I couldn't find/search all necessary block read()'s (especially for
  file:// and .gz files). But it works for normal html files.
  --> so here is the piece of code to add if it is missing for a
      particular connection (lets hope that this would be enough):

        (*targetClass.put_block)(sink, input_buffer, status);

#ifdef DISP_PARTIAL
      HText_pageDisplay(Newline,"");
#endif /* DISP_PARTIAL */

Finally:
* I hand this patch to the experts' hand for polishing (since I have to
  submit my thesis this was the only spare time I had) and now I wait for
  comments from Lynx community...


cheers,
-- 
Sinan Kaan Yerli <address@hidden>

=====BEGIN OF PATCH
*** lynx2-8//configure  Fri Mar  6 17:04:16 1998
--- lynx2-8.new//configure      Mon Mar 30 08:34:10 1998
***************
*** 7847,7853 ****
  
  trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
  
! DEFS=-DHAVE_CONFIG_H
  
  # Without the "./", some shells look in PATH for config.status.
  : ${CONFIG_STATUS=./config.status}
--- 7847,7853 ----
  
  trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
  
! DEFS='-DHAVE_CONFIG_H -DDISP_PARTIAL'
  
  # Without the "./", some shells look in PATH for config.status.
  : ${CONFIG_STATUS=./config.status}
*** lynx2-8//WWW/Library/Implementation/HTFormat.c      Fri Feb 27 18:25:07 1998
--- lynx2-8.new//WWW/Library/Implementation/HTFormat.c  Mon Mar 30 10:50:23 1998
***************
*** 600,605 ****
--- 600,609 ----
  
        (*targetClass.put_block)(sink, input_buffer, status);
  
+ #ifdef DISP_PARTIAL
+       HText_pageDisplay(Newline,"");
+ #endif /* DISP_PARTIAL */
+ 
        bytes += status;
        if (anchor && anchor->content_length > 0)
            sprintf(line, "Read %d of %d bytes of data.",
***************
*** 662,667 ****
--- 666,675 ----
        }
        (*targetClass.put_block)(sink, input_buffer, status);
  
+ #ifdef DISP_PARTIAL
+       HText_pageDisplay(Newline,"");
+ #endif /* DISP_PARTIAL */
+ 
        bytes += status;
        if (nreads >= 100) {
            /*
***************
*** 753,758 ****
--- 761,770 ----
        }
        (*targetClass.put_block)(sink, input_buffer, status);
  
+ #ifdef DISP_PARTIAL
+       HText_pageDisplay(Newline,"");
+ #endif /* DISP_PARTIAL */
+ 
        bytes += status;
        if (nreads >= 100) {
            /*
*** lynx2-8//WWW/Library/Implementation/HTTP.c  Fri Feb 13 13:53:42 1998
--- lynx2-8.new//WWW/Library/Implementation/HTTP.c      Mon Mar 30 10:50:30 1998
***************
*** 724,729 ****
--- 724,733 ----
                goto clean_up;
            }
        }
+ #ifdef DISP_PARTIAL
+       else
+           HText_pageDisplay(Newline,"");
+ #endif /* DISP_PARTIAL */
  
        bytes_already_read += status;
        sprintf (line, "Read %d bytes of data.", bytes_already_read);
*** lynx2-8//src/LYGlobalDefs.h Fri Feb 13 13:53:42 1998
--- lynx2-8.new//src/LYGlobalDefs.h     Mon Mar 30 10:50:05 1998
***************
*** 122,127 ****
--- 122,128 ----
  extern char *jumpprompt;        /* The default jump statusline prompt */
  extern int more;  /* is there more document to display? */
  extern int display_lines; /* number of lines in the display */
+ extern int Newline; /* the last line position on the file */
  extern int www_search_result;
  extern char *checked_box;  /* form boxes */
  extern char *unchecked_box;  /* form boxes */
*** lynx2-8//src/LYMainLoop.c   Fri Feb 27 18:25:07 1998
--- lynx2-8.new//src/LYMainLoop.c       Mon Mar 30 10:50:10 1998
***************
*** 90,95 ****
--- 90,97 ----
  
  PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */
  
+ PUBLIC int Newline = 0;
+ 
  PRIVATE document newdoc;
  PRIVATE document curdoc;
  PRIVATE char *traversal_host = NULL;
***************
*** 145,151 ****
      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     
*/
--- 147,152 ----
*** lynx2-8//src/LYUtils.c      Sat Mar  7 19:01:44 1998
--- lynx2-8.new//src/LYUtils.c  Mon Mar 30 10:57:33 1998
***************
*** 16,21 ****
--- 16,24 ----
  #ifdef DOSPATH
  #include "HTDOS.h"
  #endif
+ #ifdef DISP_PARTIAL
+ #include <LYKeymap.h>
+ #endif /* DISP_PARTIAL */
  #ifdef VMS
  #include <descrip.h>
  #include <libclidef.h>
***************
*** 87,92 ****
--- 90,98 ----
  extern HTkcode kanji_code;
  extern BOOLEAN LYHaveCJKCharacterSet;
  extern HTCJKlang HTCJK;
+ #ifdef DISP_PARTIAL
+ extern int Newline;
+ #endif /* DISP_PARTIAL */
  
  PRIVATE HTList * localhost_aliases = NULL;    /* Hosts to treat as local */
  PRIVATE char *HomeDir = NULL;                 /* HOME directory */
***************
*** 2117,2122 ****
--- 2123,2165 ----
  #endif /* DOSPATH */
      if (TOUPPER(c) == 'Z' || c == 7 || c == 3)
        return((int)TRUE);
+ #ifdef DISP_PARTIAL
+     else
+     {
+         switch (keymap[c+1])
+       {
+           case LYK_PREV_PAGE :
+                  if (Newline > 1)
+                    Newline -= display_lines ;
+                  break ;
+           case LYK_NEXT_PAGE :
+                  if (HText_canScrollDown())
+                    Newline += display_lines ;
+                  break ;
+           case LYK_UP_TWO :
+                  if (Newline > 1)
+                    Newline -= 2 ;
+                  break ;
+           case LYK_DOWN_TWO :
+                  if (HText_canScrollDown())
+                    Newline += 2 ;
+                  break ;
+         case LYK_HOME:
+                if (Newline > 1)
+                  Newline = 1;
+                break;
+         case LYK_END:
+                if (HText_canScrollDown())
+                  Newline = MAXINT;
+                break;
+           case LYK_REFRESH :
+                  break ;
+           default :
+                  return ((int)FALSE) ;
+       }
+       HText_pageDisplay(Newline, "");
+     }
+ #endif /* DISP_PARTIAL */
  
      /** Other keystrokes **/
      return((int)FALSE);
=====END OF PATCH

reply via email to

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