lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev25 (patch) fix newline position and more


From: Leonid Pauzner
Subject: lynx-dev dev25 (patch) fix newline position and more
Date: Sun, 2 May 1999 18:49:28 +0400 (MSD)

* fix newline position when we came from the history stack and cached HText
  used (say, return from 'p'rint menu), was broken in dev23.
* remove numerous HTMLSetCharacterHandling() calls from getfile(),
  use single call in mainloop instead.
* #define PUTS() in LYCookie.c and LYMap.c to made code more readable.



diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Sun May  2 17:33:54 1999
+++ ./lymainlo.c        Sun May  2 18:06:06 1999
@@ -961,7 +961,6 @@
                        newdoc.line = curdoc.line;
                        newdoc.link = curdoc.link;
                        newdoc.internal_link = FALSE; /* can't be true. - kw */
-                       Newline = newdoc.line; /* now here, no partial mode */
                    }

                    /*
@@ -969,9 +968,22 @@
                     *  line the user was on if s/he has been in the file
                     *  before, or it is 1 if this is a new file.
                     */
+#ifdef DISP_PARTIAL
                    /* Newline = newdoc.line; */
                    /* - alreary set and probably updated in partial mode */
-                   /*  End of incremental rendering stage here. */
+                   /* incremental rendering stage already closed (but see 
below) */
+
+                    if (Newline != Newline_partial || display_partial == TRUE) 
{
+                       /* 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 */
+#endif

                    /*
                     *  If we are going to a target line or
@@ -1051,6 +1063,8 @@
 #ifdef USE_PSRC
           psrc_view = FALSE;
 #endif
+
+          HTMLSetCharacterHandling(current_char_set);  /* restore, for sure? */

           /*
            *  Reset all of the other relevant flags. - FM

diff -u old/lygetfil.c ./lygetfil.c
--- old/lygetfil.c      Sun May  2 17:31:42 1999
+++ ./lygetfil.c        Sun May  2 18:15:50 1999
@@ -328,7 +328,6 @@
                     */
                    if ((historytarget(doc) == FALSE) ||
                        !doc || !doc->address) {
-                       HTMLSetCharacterHandling(current_char_set);
                        return(NOT_FOUND);
                    }

@@ -348,10 +347,8 @@
 #endif

                    if (!HTLoadAbsolute(&WWWDoc)) {
-                       HTMLSetCharacterHandling(current_char_set);
                        return(NOT_FOUND);
                    }
-                   HTMLSetCharacterHandling(current_char_set);
                    return(NORMAL);

                } else if (url_type == LYNXEXEC_URL_TYPE ||
@@ -718,7 +715,6 @@
                                }
                                FREE(temp);
                            }
-                           HTMLSetCharacterHandling(current_char_set);
                            url_type = is_url(use_this_url_instead);
                            if (url_type == LYNXDOWNLOAD_URL_TYPE ||
                                url_type == LYNXEXEC_URL_TYPE ||
@@ -827,7 +823,6 @@
                             */
                            goto Try_Redirected_URL;
                        }
-                       HTMLSetCharacterHandling(current_char_set);
                        return(NOT_FOUND);
                    }

@@ -857,7 +852,6 @@
                            HTParentAnchor *tmpanchor;
                            char *fname = NULL;

-                           HTMLSetCharacterHandling(current_char_set);
                            /*
                             *  Check for a suggested filename from
                             *  the Content-Disposition header. - FM
@@ -922,7 +916,6 @@
                                    *  Also check the isHEAD element. - FM
                                    */
                                   doc->isHEAD != HTLoadedDocumentIsHEAD())) {
-                           HTMLSetCharacterHandling(current_char_set);
                            /*
                             *  Nothing needed to be shown.
                             */
@@ -935,7 +928,6 @@
                         */
                            if (pound != NULL)
                                HTFindPoundSelector(pound+1);
-                           HTMLSetCharacterHandling(current_char_set);
                            return(NORMAL);
                        }
                    }

diff -u old/lymap.c ./lymap.c
--- old/lymap.c Sun May  2 18:25:36 1999
+++ ./lymap.c   Sun May  2 18:43:12 1999
@@ -537,12 +537,14 @@
        LYEntify(&MapTitle, TRUE);
     }

+#define PUTS(buf)    (*target->isa->put_block)(target, buf, strlen(buf))
+
     HTSprintf0(&buf, "<html>\n<head>\n");
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
     HTSprintf0(&buf, "<META %s content=\"text/html;charset=%s\">\n",
                "http-equiv=\"content-type\"",
                LYCharSet_UC[current_char_set].MIMEname);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
        /*
         *  This page is a list of titles and anchors for them.
         *  Since titles already passed SGML/HTML stage
@@ -550,43 +552,43 @@
         *  That is why we insist on META charset for this page.
         */
     HTSprintf0(&buf, "<title>%s</title>\n", MapTitle);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
     HTSprintf0(&buf, "</head>\n<body>\n");
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     HTSprintf0(&buf,"<h1><em>%s</em></h1>\n", MapTitle);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     StrAllocCopy(MapAddress, address);
     LYEntify(&MapAddress, FALSE);
     HTSprintf0(&buf,"<h2><em>MAP:</em>&nbsp;%s</h2>\n", MapAddress);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     HTSprintf0(&buf, "<%s compact>\n", ((keypad_mode == NUMBERS_AS_ARROWS) ?
                                    "ol" : "ul"));
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
     cur = theMap->elements;
     while (NULL != (new=(LYMapElement *)HTList_nextObject(cur))) {
        StrAllocCopy(MapAddress, new->address);
        LYEntify(&MapAddress, FALSE);
-       (*target->isa->put_block)(target, "<li><a href=\"", 13);
-       (*target->isa->put_block)(target, MapAddress, strlen(MapAddress));
+       PUTS("<li><a href=\"");
+       PUTS(MapAddress);
+       PUTS("\"");
 #ifndef DONT_TRACK_INTERNAL_LINKS
        if (new->intern_flag)
-           (*target->isa->put_block)(target, "\" TYPE=\"internal 
link\"\n>",24);
-       else
+           PUTS(" TYPE=\"internal link\"");
 #endif
-           (*target->isa->put_block)(target, "\"\n>", 3);
+       PUTS("\n>");
        StrAllocCopy(MapTitle, new->title);
        LYEntify(&MapTitle, TRUE);
-       (*target->isa->put_block)(target, MapTitle, strlen(MapTitle));
-       (*target->isa->put_block)(target, "</a>\n", 5);
+       PUTS(MapTitle);
+       PUTS("</a>\n");
     }
     HTSprintf0(&buf, "</%s>\n</body>\n</html>\n",
                    ((keypad_mode == NUMBERS_AS_ARROWS)
                    ? "ol"
                    : "ul"));
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     (*target->isa->_free)(target);
     FREE(MapAddress);

diff -u old/lycookie.c ./lycookie.c
--- old/lycookie.c      Sun May  2 17:31:48 1999
+++ ./lycookie.c        Sun May  2 17:45:48 1999
@@ -2474,22 +2474,25 @@
      * Load HTML strings into buf and pass buf
      * to the target for parsing and rendering. - FM
      */
+#define PUTS(buf)    (*target->isa->put_block)(target, buf, strlen(buf))
+
+
     HTSprintf0(&buf, "<HEAD>\n<TITLE>%s</title>\n</HEAD>\n<BODY>\n",
                 COOKIE_JAR_TITLE);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
     HTSprintf0(&buf, "<h1>%s (%s)%s<a href=\"%s%s\">%s</a></h1>\n",
        LYNX_NAME, LYNX_VERSION,
        HELP_ON_SEGMENT,
        helpfilepath, COOKIE_JAR_HELP, COOKIE_JAR_TITLE);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     HTSprintf0(&buf, "<NOTE>%s\n", ACTIVATE_TO_GOBBLE);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
     HTSprintf0(&buf, "%s</NOTE>\n", OR_CHANGE_ALLOW);
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     HTSprintf0(&buf, "<DL COMPACT>\n");
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);
     for (dl = domain_list; dl != NULL; dl = dl->next) {
        de = dl->object;
        if (de == NULL)
@@ -2503,7 +2506,7 @@
         */
        HTSprintf0(&buf, "<DT>%s<DD><A 
HREF=\"LYNXCOOKIE://%s/\">Domain=%s</A>\n",
                      de->domain, de->domain, de->domain);
-       (*target->isa->put_block)(target, buf, strlen(buf));
+       PUTS(buf);
        switch (de->bv) {
            case (ACCEPT_ALWAYS):
                HTSprintf0(&buf, COOKIES_ALWAYS_ALLOWED);
@@ -2520,9 +2523,9 @@
 #endif
                break;
        }
-       (*target->isa->put_block)(target, buf, strlen(buf));
+       PUTS(buf);
        HTSprintf0(&buf, "\n");
-       (*target->isa->put_block)(target, buf, strlen(buf));
+       PUTS(buf);

        /*
         *  Show the domain's cookies. - FM
@@ -2553,11 +2556,11 @@
                         de->domain, co->lynxID, name, value);
            FREE(name);
            FREE(value);
-           (*target->isa->put_block)(target, buf, strlen(buf));
+           PUTS(buf);

            if (co->flags & COOKIE_FLAG_FROM_FILE) {
                HTSprintf0(&buf, "%s\n", gettext("(from a previous session)"));
-               (*target->isa->put_block)(target, buf, strlen(buf));
+               PUTS(buf);
            }

            /*
@@ -2574,14 +2577,14 @@
                         ((co->flags & COOKIE_FLAG_SECURE) ? "YES" : "NO"),
                         ((co->flags & COOKIE_FLAG_DISCARD) ? "YES" : "NO"));
            FREE(path);
-           (*target->isa->put_block)(target, buf, strlen(buf));
+           PUTS(buf);

            /*
             *  Show the list of acceptable ports, if present. - FM
             */
            if (co->PortList) {
                HTSprintf0(&buf, "<DD>PortList=\"%s\"\n", co->PortList);
-               (*target->isa->put_block)(target, buf, strlen(buf));
+               PUTS(buf);
            }

            /*
@@ -2598,7 +2601,7 @@
                        Title);
                FREE(Address);
                FREE(Title);
-               (*target->isa->put_block)(target, buf, strlen(buf));
+               PUTS(buf);
            }

            /*
@@ -2609,7 +2612,7 @@
                LYEntify(&comment, TRUE);
                HTSprintf0(&buf, "<DD>Comment: %s\n", comment);
                FREE(comment);
-               (*target->isa->put_block)(target, buf, strlen(buf));
+               PUTS(buf);
            }

            /*
@@ -2623,13 +2626,13 @@
                         ((co->flags & COOKIE_FLAG_EXPIRES_SET)
                                            ?
                                         "" : "\n"));
-           (*target->isa->put_block)(target, buf, strlen(buf));
+           PUTS(buf);
        }
        HTSprintf0(&buf, "</DT>\n");
-       (*target->isa->put_block)(target, buf, strlen(buf));
+       PUTS(buf);
     }
     HTSprintf0(&buf, "</DL>\n</BODY>\n");
-    (*target->isa->put_block)(target, buf, strlen(buf));
+    PUTS(buf);

     /*
      * Free the target to complete loading of the




reply via email to

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