lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev.16 patch 1


From: Leonid Pauzner
Subject: lynx-dev dev.16 patch 1
Date: Wed, 1 Dec 1999 11:44:28 +0300 (MSK)

Since Tom introduce LYGetNewline()/LYSetNewline()
and I completely forgot about yet another Newline initialization in
GridText.c, I made the next step for partial display code simplification.
Lots of (-) below.


* remove global Newline_partial, use LYGetNewline() instead.



diff -u old/gridtext.c ./gridtext.c
--- old/gridtext.c      Wed Dec  1 08:15:20 1999
+++ ./gridtext.c        Wed Dec  1 09:28:20 1999
@@ -46,10 +46,6 @@

 #undef DEBUG_APPCH

-#ifdef DISP_PARTIAL
-#include <LYMainLoop.h>
-#endif
-
 #ifdef SOURCE_CACHE
 #include <HTFile.h>
 #endif
@@ -8082,10 +8078,7 @@
            FREE(HTMainAnchor->source_cache_file);
            return FALSE;
        }
-#ifdef DISP_PARTIAL
-       display_partial = display_partial_flag;  /* restore */
-       Newline_partial = LYGetNewline();  /* initialize */
-#endif
+
        if (HText_HaveUserChangedForms()) {
            /*
             * Issue a warning.  Will not restore changed forms, currently.
@@ -8125,10 +8118,6 @@
                                         UCLYhndl_for_unspec);
        /* not UCLYhndl_HTFile_for_unspec - we are talking about remote 
documents... */

-#ifdef DISP_PARTIAL
-       display_partial = display_partial_flag;  /* restore */
-       Newline_partial = LYGetNewline();  /* initialize */
-#endif
        if (HText_HaveUserChangedForms()) {
            /*
             * Issue a warning.  Will not restore changed forms, currently.
diff -u old/htformat.c ./htformat.c
--- old/htformat.c      Wed Dec  1 08:09:44 1999
+++ ./htformat.c        Wed Dec  1 11:31:32 1999
@@ -516,6 +516,7 @@
        /*
        **  HText_getNumOfLines() = "current" number of complete lines received
        **  NumOfLines_partial = number of lines at the moment of last repaint.
+       **  (we update NumOfLines_partial only when we repaint the display.)
        **
        **  display_partial could only be enabled in HText_new()
        **  so a new HTMainText object available - all HText_ functions use it,
@@ -528,6 +529,8 @@
        **
        **  So repaint the page only when necessary:
        */
+       int Newline_partial = LYGetNewline();
+
        if (((Newline_partial + display_lines) > NumOfLines_partial)
                /* current page not complete... */
        && (partial_threshold > 0 ?
diff -u old/lyglobal.h ./lyglobal.h
--- old/lyglobal.h      Wed Dec  1 08:15:22 1999
+++ ./lyglobal.h        Wed Dec  1 09:24:08 1999
@@ -289,7 +289,6 @@
 extern BOOLEAN no_url_redirection;   /* Don't follow URL redirections */
 #ifdef DISP_PARTIAL
 extern BOOLEAN display_partial;      /* Display document while loading */
-extern int Newline_partial;          /* -//- "current" newline position */
 extern int NumOfLines_partial;       /* -//- "current" number of lines */
 extern int partial_threshold;
 extern BOOLEAN debug_display_partial;  /* show with MessageSecs delay */
diff -u old/lyhistor.c ./lyhistor.c
--- old/lyhistor.c      Wed Dec  1 08:15:32 1999
+++ ./lyhistor.c        Wed Dec  1 09:26:50 1999
@@ -424,10 +424,6 @@
        doc->isHEAD = history[nhist].isHEAD;
        doc->safe = history[nhist].safe;
        doc->internal_link = history[nhist].internal_link;
-#ifdef DISP_PARTIAL
-       /* assume we pop the 'doc' to show it soon... */
-       Newline_partial = doc->line;    /* reinitialize */
-#endif /* DISP_PARTIAL */
        CTRACE((tfp, "LYpop[%d]: address:%s\n     title:%s\n",
                    nhist, doc->address, doc->title));
     }
@@ -453,10 +449,6 @@
        doc->isHEAD = history[number].isHEAD;
        doc->safe = history[number].safe;
        doc->internal_link = history[number].internal_link; /* ?? */
-#ifdef DISP_PARTIAL
-       /* assume we pop the 'doc' to show it soon... */
-       Newline_partial = doc->line;    /* reinitialize */
-#endif /* DISP_PARTIAL */
     }
 }

diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Wed Dec  1 08:15:34 1999
+++ ./lymainlo.c        Wed Dec  1 11:06:40 1999
@@ -202,7 +202,6 @@

 #ifdef DISP_PARTIAL
 PUBLIC BOOLEAN display_partial = FALSE; /* could be enabled in HText_new() */
-PUBLIC int Newline_partial = 0;     /* newline position in partial mode */
 PUBLIC int NumOfLines_partial = 0;  /* number of lines displayed in partial 
mode */
 #endif

@@ -368,21 +367,27 @@
     Newline = value;
 }

+#ifdef DISP_PARTIAL
+/*
+ * This function used in partial display mode in LYUtils.c and HTFormat.c,
+ * it returns newdoc.line position (not a Newline: the document may come
+ * from the history stack via LYpop() or LYpop_num() in the getfile() cycle
+ * so newdoc will be changed but we need the latest info).
+ */
 PUBLIC int LYGetNewline NOARGS
 {
-    return Newline;
+    return newdoc.line;
 }

 /*
- * This is for traversal call from within partial mode in LYUtils.c
- * and HTFormat. It simply calls HText_pageDisplay()
- * but utilizes LYMainLoop.c PRIVATE variables (currently 'prev_target').
+ * This is for traversal call from within partial mode.
+ * It simply calls HText_pageDisplay() but utilizes
+ * LYMainLoop.c PRIVATE variables.
  * Perhaps, this could adhere more logic from mainloop(), in the future.
  */
 PUBLIC void LYMainLoop_pageDisplay ARGS1(
        int,            line_num)
 {
-#ifdef DISP_PARTIAL
     /*
      * Disable display_partial if requested URL has #fragment and we are not
      * popped from the history stack so can't calculate correct newline
@@ -397,15 +402,15 @@
     }

     /*
-     *  Override Newline with a new value if user
-     *  scrolled the document while loading.
-     *  Newline = Newline_partial;
+     *  Override newdoc.line with a new value if user
+     *  scrolled the document while loading (in LYUtils.c).
      */
-#endif
+    newdoc.line = line_num;

-    Newline = line_num;
-    HText_pageDisplay(Newline, prev_target);
+    HText_pageDisplay(newdoc.line, prev_target);
 }
+#endif /* DISP_PARTIAL */
+

 PRIVATE int do_change_link NOARGS
 {
@@ -5309,15 +5314,11 @@
                    LYPermitURL = TRUE;
                }

-               /* reset these two variables here before getfile()
-                * so they will be available in partial mode
+               /* reset this variable here before getfile()
+                * so it will be available in partial mode
                 * (was previously implemented in case NORMAL).
                 */
-                *prev_target = '\0';   /* Reset for new coming document */
-               Newline = newdoc.line;  /* bypass for partial mode */
-#ifdef DISP_PARTIAL
-               Newline_partial = Newline;  /* initialize */
-#endif /* DISP_PARTIAL */
+               *prev_target = '\0';    /* Reset for new coming document */

 #ifdef USE_PSRC
                psrc_first_tag = TRUE;
@@ -5767,24 +5768,12 @@
                     *  Set Newline to the saved line.  It contains the
                     *  line the user was on if s/he has been in the file
                     *  before, or it is 1 if this is a new file.
+                    *
+                    *  In partial mode, newdoc.line was probably updated
+                    *  if user scrolled the document while loading.
+                    *  Incremental loading stage already closed [in HT*Copy()].
                     */
-#ifdef DISP_PARTIAL
-                   /* Newline = newdoc.line; */
-                   /* - already set and probably updated in partial mode */
-                   /* incremental rendering stage already closed (but see 
below) */
-
-                   if (display_partial == TRUE || Newline != Newline_partial) {
-                       /* This is the case when we came from the history stack
-                        * _and_ cached HText was used instead of HT*Copy()
-                        * call.  Set Newline and close partial mode here.
-                        */
-                       Newline = Newline_partial;
-                       display_partial = FALSE;
-                   }
-#else
-                   Newline = newdoc.line; /* now here, no partial mode */
-                   /* *prev_target = '\0'; */ /* Reset for this document. - FM 
*/
-#endif
+                   Newline = newdoc.line;

                    /*
                     *  If we are going to a target line or
diff -u old/lyutils.c ./lyutils.c
--- old/lyutils.c       Wed Dec  1 08:28:16 1999
+++ ./lyutils.c Wed Dec  1 09:25:00 1999
@@ -2330,6 +2330,8 @@
        {
            BOOLEAN do_refresh;
            int res;
+           int Newline_partial = LYGetNewline();
+
            switch (cmd)
            {
            case LYK_WHEREIS: /* search within the document */




reply via email to

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