On Mon, Aug 06, 2001 at 04:04:36PM +0900, Hataguchi Takeshi wrote:
> I tried Lynx 2-8-4rel.1 and found some problems in it.
> 
>   1. I couldn't follow the 2nd (shonai College), 3rd (Japanese
>     Edition) and the 4th (Student's Pictures) link in 
>     http://www.shonai-cit.ac.jp/ibm/index.htm
>     when EXP_NESTED_TABLES is defined.
> 
>     # I could follow them when nested-table parsing off.

here's a fix for that problem (along with the usual nits that I found while
looking for the fix):


-- 
Thomas E. Dickey <[EMAIL PROTECTED]>
http://dickey.his.com
ftp://dickey.his.com
# ------------------------------------------------------------------------------
# CHANGES                               |   12 ++++++
# WWW/Library/Implementation/HTAnchor.c |    6 +--
# WWW/Library/Implementation/HText.h    |    8 ----
# src/GridText.c                        |   60 +++++++++++++++-----------------
# src/GridText.h                        |    4 --
# src/LYStyle.c                         |    1 
# src/structdump.h                      |   47 ++++++++++++-------------
# 7 files changed, 67 insertions(+), 71 deletions(-)
# ------------------------------------------------------------------------------
Index: CHANGES
--- lynx2.8.5dev.1+/CHANGES     Tue Jul 24 20:54:30 2001
+++ lynx2.8.5dev.1b/CHANGES     Sun Aug 12 17:43:57 2001
@@ -1,6 +1,18 @@
 Changes since Lynx 2.8 release
 ===============================================================================
 
+2001-08-13 (2.8.5dev.2)
+* modify logic in move_anchors_in_region() to ensure that when an anchor is
+  shifted right by nested-table logic, if it happens to be split across a
+  line its size will be adjusted properly (report by Hataguchi Takeshi) -TD
+* correct logic used for trimming TEXTAREA introduced in 2.8.4pre.3, which did
+  not trim carriage-return characters if TRIM_INPUT_FIELDS was false.
+  (report by Hataguchi Takeshi <[EMAIL PROTECTED]>) -TD
+* correct a bug in search logic which happens with pages shorter than the
+  screen, due to improper starting-line value sent to search function.  Fixed
+  by adding checks in www_search_backward() and www_search_foreward(), (report
+  by -Frederic L W Meunier) -TD
+
 2001-07-24 (2.8.5dev.1)
 * modify GetChar() definition for PDCurses to ignore key-modifiers which are
   passed back from getch() as if they were key codes.  Those interfere with
Index: WWW/Library/Implementation/HTAnchor.c
--- lynx2.8.5dev.1+/WWW/Library/Implementation/HTAnchor.c       Sun Jun 10 21:14:52 
2001
+++ lynx2.8.5dev.1b/WWW/Library/Implementation/HTAnchor.c       Sun Aug 12 14:03:50 
+2001
@@ -269,13 +269,13 @@
 #ifdef DUPLICATE_ANCHOR_NAME_WORKAROUND
        if (tag && *tag) {
            HTAnchor *testdest1;
-           int nlinks;
+           int child_links;
            testdest1 = child->mainLink.dest;
            if (testdest1) {
-               nlinks = 1 + HTList_count(child->links);
+               child_links = 1 + HTList_count(child->links);
                CTRACE((tfp,
                       "*** Duplicate ChildAnchor %p named `%s' with %d links",
-                      child, tag, nlinks));
+                      child, tag, child_links));
                if (dest == testdest1 && ltype == child->mainLink.type) {
                    CTRACE((tfp,", same dest %p and type, keeping it\n",
                           testdest1));
Index: WWW/Library/Implementation/HText.h
--- lynx2.8.5dev.1+/WWW/Library/Implementation/HText.h  Sun Jun  3 17:17:35 2001
+++ lynx2.8.5dev.1b/WWW/Library/Implementation/HText.h  Sun Aug 12 13:28:39 2001
@@ -149,14 +149,6 @@
 
 /*
 
-  DUMP DIAGNOSTICS TO STDERR
-
- */
-
-extern void HText_dump PARAMS((HText * me));
-
-/*
-
   RETURN THE ANCHOR ASSOCIATED WITH THIS NODE
 
  */
Index: src/GridText.c
--- lynx2.8.5dev.1+/src/GridText.c      Tue Jul 10 15:48:01 2001
+++ lynx2.8.5dev.1b/src/GridText.c      Sun Aug 12 17:44:21 2001
@@ -75,6 +75,11 @@
 #define FirstHTLine(text) ((text)->last_line->next)
 #define LastHTLine(text)  ((text)->last_line)
 
+PRIVATE void HText_trimHightext PARAMS((
+       HText *         text,
+       BOOLEAN         final,
+       int             stop_before));
+
 #ifdef USE_COLOR_STYLE
 PRIVATE void LynxResetScreenCache NOARGS
 {
@@ -2385,10 +2390,14 @@
            head_processed = 1;
        }
        /* Fix the end */
-       if ( last < ebyte )
+       a->extent += shift;
+       if ( last >= ebyte ) {
+           /* the anchor is split across a line.  Add a shift for the
+            * next part of the anchor so we'll highlight that, too.
+            */
            a->extent += shift;
-       else
            break;                      /* Keep this `a' for the next step */
+       }
     }
     *prev_anchor = a;
     *prev_head_processed = head_processed;
@@ -5272,7 +5281,7 @@
            /*
             *  The anchor's content is not restricted to white
             *  and special characters, so we'll display the
-            *  content, but shorten it's extent by any trailing
+            *  content, but shorten its extent by any trailing
             *  blank lines we've detected. - FM
             */
            a->extent -= ((BlankExtent < a->extent) ?
@@ -5455,7 +5464,7 @@
 **  This needs to be done so that display_page finds the anchors in the
 **  form it expects when it sets the links[] elements.
 */
-PUBLIC void HText_trimHightext ARGS3(
+PRIVATE void HText_trimHightext ARGS3(
        HText *,        text,
        BOOLEAN,        final,
        int,            stop_before)
@@ -5677,15 +5686,6 @@
 }
 
 
-/*     Dump diagnostics to tfp
-*/
-PUBLIC void HText_dump ARGS1(
-       HText *,        text GCC_UNUSED)
-{
-    CTRACE((tfp, "HText: Dump called\n"));
-}
-
-
 /*     Return the anchor associated with this node
 */
 PUBLIC HTParentAnchor * HText_nodeAnchor ARGS1(
@@ -7736,7 +7736,7 @@
        HTLine *,       line,
        int,            count)
 {
-    BOOL wrapped = FALSE;
+    int wrapped = 0;
     TextAnchor *a = line_num_to_anchor(count - 1);
     int tentative_result = -1;
 
@@ -7756,12 +7756,12 @@
        if (LYno_attr_strstr(line->data, target)) {
            tentative_result = count;
            break;
-       } else if (count == start_line && wrapped) {
+       } else if ((count == start_line && wrapped) || wrapped > 1) {
            HTUserMsg2(STRING_NOT_FOUND, target);
            return -1;
        } else if (line == HTMainText->last_line) {
            count = 0;
-           wrapped = TRUE;
+           wrapped++;
        }
        line = line->next;
        count++;
@@ -7779,7 +7779,7 @@
        HTLine *,       line,
        int,            count)
 {
-    BOOL wrapped = FALSE;
+    int wrapped = 0;
     TextAnchor *a = line_num_to_anchor(count - 1);
     int tentative_result = -1;
 
@@ -7799,12 +7799,12 @@
        if (LYno_attr_strstr(line->data, target)) {
            tentative_result = count;
            break;
-       } else if (count == start_line && wrapped) {
+       } else if ((count == start_line && wrapped) || wrapped > 1) {
            HTUserMsg2(STRING_NOT_FOUND, target);
            return -1;
        } else if (line == FirstHTLine(HTMainText)) {
            count = line_num_in_text(HTMainText, LastHTLine(HTMainText)) + 1;
-           wrapped = TRUE;
+           wrapped++;
        }
        line = line->prev;
        count--;
@@ -11275,6 +11275,8 @@
     return(FALSE);
 }
 
+#define CanTrimTextArea(c) \
+    (LYtrimInputFields ? isspace(c) : ((c) == '\r' || (c) == '\n'))
 
 /*
  *  Cleanup new lines coming into a TEXTAREA from an external editor, or a
@@ -11301,13 +11303,11 @@
     /*
      *  Whack off trailing whitespace from the line.
      */
-    if (LYtrimInputFields) {
-       for (i = len, p = line + (len - 1); i != 0; p--, i--) {
-           if (isspace(UCH(*p)))
-               *p = '\0';
-           else
-               break;
-       }
+    for (i = len, p = line + (len - 1); i != 0; p--, i--) {
+       if (CanTrimTextArea(UCH(*p)))
+           *p = '\0';
+       else
+           break;
     }
 
     if (strlen (line) != 0) {
@@ -12057,11 +12057,9 @@
     /*
      * Nuke any blank lines from the end of the edited data.
      */
-    if (LYtrimInputFields) {
-       while ((size != 0)
-        && (isspace(UCH(ebuf[size-1])) || (ebuf[size-1] == '\0')))
-           ebuf[--size] = '\0';
-    }
+    while ((size != 0)
+     && (CanTrimTextArea(UCH(ebuf[size-1])) || (ebuf[size-1] == '\0')))
+       ebuf[--size] = '\0';
 
     /*
      * Copy each line from the temp file into the corresponding anchor
Index: src/GridText.h
--- lynx2.8.5dev.1+/src/GridText.h      Sat Jul  7 21:41:23 2001
+++ lynx2.8.5dev.1b/src/GridText.h      Sun Aug 12 13:27:55 2001
@@ -207,10 +207,6 @@
        HText *         text,
        BOOL            underline,
        InputFieldData *I));
-extern void HText_trimHightext PARAMS((
-       HText *         text,
-       BOOLEAN         final,
-       int             stop_before));
 extern int HText_SubmitForm PARAMS((
        FormInfo *      submit_item,
        document *      doc,
Index: src/LYStyle.c
Prereq:  1.47 
--- lynx2.8.5dev.1+/src/LYStyle.c       Tue Jul 24 20:54:30 2001
+++ lynx2.8.5dev.1b/src/LYStyle.c       Sun Aug 12 17:52:35 2001
@@ -417,7 +417,6 @@
 
 PUBLIC void parse_userstyles NOARGS
 {
-    static BOOL first = TRUE;
     char *name;
     HTList *cur = lss_styles;
 
Index: src/structdump.h
--- lynx2.8.5dev.1+/src/structdump.h    Wed Sep 29 07:47:35 1999
+++ lynx2.8.5dev.1b/src/structdump.h    Sun Aug 12 17:54:57 2001
@@ -10,15 +10,15 @@
 #define   DUMPSTRUCT_LINK(L,X) \
 if ((L)) { \
 CTRACE((tfp, "\n" \
-            "KED:     link_ptr=0x%08x  sizeof=%d  ["X"]\n" \
+            "KED:     link_ptr=%p  sizeof=%d  ["X"]\n" \
             "link       struct {\n"      \
-            "           *lname=0x%08x\n" \
+            "           *lname=%p\n"     \
             "            lname=|%s|\n"   \
-            "          *target=0x%08x\n" \
+            "          *target=%p\n"     \
             "           target=|%s|\n"   \
-            "        *hightext=0x%08x\n" \
+            "        *hightext=%p\n"     \
             "         hightext=|%s|\n"   \
-            "       *hightext2=0x%08x\n" \
+            "       *hightext2=%p\n"     \
             "        hightext2=|%s|\n"   \
             " hightext2_offset=%d\n"     \
             "      inUnderline=%1x\n"    \
@@ -27,7 +27,7 @@
             "             type=%d\n"     \
             "    anchor_number=%d\n"     \
             "  anchor_line_num=%d\n"     \
-            "            *form=0x%08x\n" \
+            "            *form=%p\n"     \
             "}\n", \
             (L), sizeof(*((L))), \
             (L)->lname, (L)->lname, (L)->target, (L)->target, \
@@ -45,33 +45,32 @@
 #define   DUMPSTRUCT_ANCHOR(A,X) \
 if ((A)) { \
 CTRACE((tfp, "\n" \
-            "KED:   anchor_ptr=0x%08x  sizeof=%d  ["X"]\n" \
+            "KED:   anchor_ptr=%p  sizeof=%d  ["X"]\n" \
             "TextAnchor struct {\n"      \
-            "            *next=0x%08x\n" \
+            "            *next=%p\n"     \
             "           number=%d\n"     \
-            "            start=%d\n"     \
             "         line_pos=%d\n"     \
             "           extent=%d\n"     \
             "         line_num=%d\n"     \
-            "        *hightext=0x%08x\n" \
+            "        *hightext=%p\n"     \
             "         hightext=|%s|\n"   \
-            "       *hightext2=0x%08x\n" \
+            "       *hightext2=%p\n"     \
             "        hightext2=|%s|\n"   \
             "  hightext2offset=%d\n"     \
             "        link_type=%d\n"     \
-            "     *input_field=0x%08x\n" \
+            "     *input_field=%p\n"     \
             "      input_field=|%s|\n"   \
             "      show_anchor=%1x\n"    \
             "      inUnderline=%1x\n"    \
             "   expansion_anch=%1x\n"    \
-            "          *anchor=0x%08x\n" \
+            "          *anchor=%p\n"     \
             "}\n", \
             (A), sizeof(*((A))), \
-            (A)->next, (A)->number, (A)->start, (A)->line_pos, \
+            (A)->next, (A)->number, (A)->line_pos, \
             (A)->extent, (A)->line_num, \
             (A)->hightext, (A)->hightext, (A)->hightext2, (A)->hightext2, \
             (A)->hightext2offset, (A)->link_type, \
-            (A)->input_field, (A)->input_field, (A)->show_anchor, \
+            (A)->input_field, (A)->input_field->name, (A)->show_anchor, \
             (A)->inUnderline, (A)->expansion_anch, (A)->anchor)); \
 }else{ \
 CTRACE((tfp, "\n" \
@@ -84,15 +83,15 @@
 #define   DUMPSTRUCT_FORMINFO(F,X) \
 if ((F)) { \
 CTRACE((tfp, "\n" \
-            "KED: forminfo_ptr=0x%08x  sizeof=%d  ["X"]\n" \
+            "KED: forminfo_ptr=%p  sizeof=%d  ["X"]\n" \
             "FormInfo   struct {\n"      \
-            "            *name=0x%08x\n" \
+            "            *name=%p\n"     \
             "             name=|%s|\n"   \
             "           number=%d\n"     \
             "             type=%d\n"     \
-            "           *value=0x%08x\n" \
+            "           *value=%p\n"     \
             "            value=|%s|\n"   \
-            "      *orig_value=0x%08x\n" \
+            "      *orig_value=%p\n"     \
             "       orig_value=|%s|\n"   \
             "             size=%d\n"     \
             "        maxlength=%d\n"     \
@@ -100,7 +99,7 @@
             "        num_value=%d\n"     \
             "           hrange=%d\n"     \
             "           lrange=%d\n"     \
-            "     *select_list=0x%08x\n" \
+            "     *select_list=%p\n"     \
             "    submit_action=|%s|\n"   \
             "    submit_method=%d\n"     \
             "   submit_enctype=|%s|\n"   \
@@ -134,17 +133,17 @@
 #define   DUMPSTRUCT_LINE(L,X) \
 if ((L)) { \
 CTRACE((tfp, "\n" \
-            "KED: htline_ptr=0x%08x  sizeof=%d  ["X"]\n" \
+            "KED: htline_ptr=%p  sizeof=%d  ["X"]\n" \
             "HTLine  struct {\n"      \
-            "         *next=0x%08x\n" \
-            "         *prev=0x%08x\n" \
+            "         *next=%p\n"     \
+            "         *prev=%p\n"     \
             "        offset=%d\n"     \
             "          size=%d\n"     \
             "   split_after=%1x\n"    \
             "        bullet=%1x\n"    \
             "expansion_line=%1x\n"    \
             "w/o U_C_S def\n"         \
-            "        data[]=0x%08x\n" \
+            "        data[]=%p\n"     \
             "          data=|%s|\n"   \
             "}\n", \
             (L), sizeof(*((L))), \

Reply via email to