lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev PATCH [dev22]: source caching fixes (was: patch to fix PSRC mod


From: Scott Bigham
Subject: lynx-dev PATCH [dev22]: source caching fixes (was: patch to fix PSRC mode with SOURCE_CACHE!=NONE)
Date: Wed, 14 Apr 1999 12:01:05 -0400 (EDT)

On Tue, 13 Apr 1999, Vlad Harchev wrote:

>  I have the following problem with dev22:
>  When pressing '\' on non-local files, the psrc view is shown, but there is no
> way out of this mode. This patch will fix it. 

Actually, I already have a more localized fix of that in this patch.
Also included are fixes for related bugs tweaked by going to an internal
page while viewing source, and a few blurbs in the documentation (which
don't really say much, but...).

[Note to Tom:  if you've already applied Leonid's recent
 UCLYhndl<mumble> patch, then you can punt the part of this patch that
 touches HTAccess.[ch], because his patch already does what mine needs.]

                                                -sbigham

--- ./WWW/Library/Implementation/HTAccess.c.orig        Tue Apr 13 05:39:16 1999
+++ ./WWW/Library/Implementation/HTAccess.c     Wed Apr 14 11:28:16 1999
@@ -592,7 +592,15 @@
  *  UCLYhndl_for_unspec used for charset "assuming" from the values
  *  saved by LYUCPushAssumed, if any. - kw
  */
-PRIVATE int LYUCPopAssumed NOARGS
+#ifdef SOURCE_CACHE
+/*
+ * We need this outside...  -dsb
+ */
+PUBLIC
+#else
+PRIVATE
+#endif
+int LYUCPopAssumed NOARGS
 {
     if (pushed_assume_LYhndl >= 0) {
        UCLYhndl_for_unspec = pushed_assume_LYhndl;
--- ./WWW/Library/Implementation/HTAccess.h.orig        Wed Mar 17 22:17:11 1999
+++ ./WWW/Library/Implementation/HTAccess.h     Tue Apr 13 17:39:29 1999
@@ -305,6 +305,9 @@
 
 extern void LYUCPushAssumed PARAMS((
     HTParentAnchor *   anchor));
+#ifdef SOURCE_CACHE
+extern int LYUCPopAssumed NOPARAMS;
+#endif
 
 #endif /* HTACCESS_H */
 /*
--- ./lynx_help/Lynx_users_guide.html.orig      Tue Apr 13 05:39:16 1999
+++ ./lynx_help/Lynx_users_guide.html   Wed Apr 14 10:00:22 1999
@@ -141,7 +141,8 @@
 where to find the linked file and what kind of server will provide it
 (i.e., HTTP, Gopher, etc.).
 
-<p>Lynx renders HTML files and saves the rendition, not the source,
+<p>Lynx renders HTML files and saves the rendition (and the source, if
+so configured in the <A HREF="#lynx.cfg">lynx.cfg</A> file)
 for initial display and should you select the link again.  If you do
 select a link again and have reason to desire a new fetch and rendering
 of the file, use the NOCACHE command, normally mapped to '<em>x</em>' and
@@ -338,9 +339,10 @@
 
 When viewing HTML documents it is possible to retrieve and display the
 unrendered (i.e., the original HTML) source of the document by pressing
-the '<em>\</em>' (backslash) key.  The document must be reloaded from the
-server or disk to be displayed on the screen unrendered, since Lynx
-originally rendered what it received and does not still have it as source.
+the '<em>\</em>' (backslash) key.  Lynx usually caches only the rendering
+of the document and doesn't keep the source (unless it is configured to do
+so in the <A HREF="#lynx.cfg">lynx.cfg</A> file), so to display the source
+unrendered, Lynx must reload it from the server or disk.
 When viewing unrendered documents you may print them as any normal document.
 
 <p>Selecting the <em>Print to a local file</em> option from the Print Menu,
--- ./src/LYMainLoop.c.orig     Tue Apr 13 05:39:16 1999
+++ ./src/LYMainLoop.c  Wed Apr 14 11:27:19 1999
@@ -1260,7 +1260,7 @@
 #ifdef SOURCE_CACHE
        /*
         * If the parse settings have changed since this HText was
-        * generated, we need to reparse and redraw it.
+        * generated, we need to reparse and redraw it.  -dsb
         */
        if (HTdocument_settings_changed()) {
            HTUserMsg(gettext("Reparsing document under current settings..."));
@@ -1269,7 +1269,7 @@
            else {
                /*
                 * Urk.  I have no idea how to recover from a failure here.
-                * At a guess, I'll try reloading.
+                * At a guess, I'll try reloading.  -dsb
                 */
                cmd = LYK_RELOAD;
                goto new_cmd;
@@ -1358,6 +1358,15 @@
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
                showtags(tagged);
 #endif /* DIRED_SUPPORT */
+#ifdef SOURCE_CACHE
+           /*
+            * This information can get clobbered if we go to an internal
+            * page while viewing source.  Normally it would be recreated
+            * by reloading the file; we have to do it ourselves.  -dsb
+            */
+           if (curdoc.link < 0 && nlinks > 0)
+               curdoc.link = 0;
+#endif
            if (user_mode == NOVICE_MODE)
                noviceline(more);  /* print help message */
            refresh_screen = FALSE;
@@ -2110,6 +2119,17 @@
 #ifdef SOURCE_CACHE
            if (HTreparse_document()) {
                refresh_screen = TRUE;
+               /*
+                * These normally get cleaned up after getfile() returns;
+                * since we're not calling getfile(), we have to clean them
+                * up ourselves.  -dsb
+                */
+               HTOutputFormat = WWW_PRESENT;
+#ifdef USE_PSRC
+               if (psrc_view)
+                   HTMark_asSource();
+               psrc_view = FALSE;
+#endif
                break;
            }
 #endif
--- ./src/GridText.c.orig       Tue Apr 13 05:39:16 1999
+++ ./src/GridText.c    Wed Apr 14 11:27:08 1999
@@ -561,7 +561,7 @@
     self->LastChar = '\0';
     self->IgnoreExcess = FALSE;
 
-#ifndef PSRC_TEST
+#ifndef USE_PSRC
     if (HTOutputFormat == WWW_SOURCE)
        self->source = YES;
     else
@@ -6186,7 +6186,7 @@
 
        /*
         * This is more or less copied out of HTLoadFile(), except we don't
-        * get a content encoding.  This may be overkill...
+        * get a content encoding.  This may be overkill.  -dsb
         */
        if (HTMainText->node_anchor->content_type) {
            format = HTAtom_for(HTMainText->node_anchor->content_type);
@@ -6241,6 +6241,11 @@
            source_cache_chunk = NULL;
        }
     }
+
+    /*
+     * I have no idea what this does, but it seems to be necessary... -dsb
+     */
+    LYUCPopAssumed();
 
     CTRACE(tfp, "Reparse %s\n", (ok ? "succeeded" : "failed"));
     return ok;


reply via email to

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