about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2001-07-08 01:41:23 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2001-07-08 01:41:23 -0400
commit17f50de9c561c4bae6401ebc2edad9d75ff096c9 (patch)
tree89dc173cdb1695a59ee61a1528458d7a066e08d8 /src
parent244151ea1ed7b05051bd92a653bbde57c8194061 (diff)
downloadlynx-snapshots-17f50de9c561c4bae6401ebc2edad9d75ff096c9.tar.gz
snapshot of project "lynx", label v2-8-4pre_3
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c94
-rw-r--r--src/GridText.h1
-rw-r--r--src/HTML.c60
-rw-r--r--src/LYCurses.c25
-rw-r--r--src/LYCurses.h1
-rw-r--r--src/LYForms.c11
-rw-r--r--src/LYGlobalDefs.h1
-rw-r--r--src/LYMain.c23
-rw-r--r--src/LYMainLoop.c3
-rw-r--r--src/LYPrettySrc.c3
-rw-r--r--src/LYPrettySrc.h2
-rw-r--r--src/LYReadCFG.c1
-rw-r--r--src/LYStyle.c80
-rw-r--r--src/TRSTable.c149
-rw-r--r--src/TRSTable.h6
15 files changed, 300 insertions, 160 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 4562103c..db8c49d1 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -2795,7 +2795,7 @@ PRIVATE void split_line ARGS2(
 	while (scan >= previous->styles && at_end >= previous->styles) {
 	    /* The algorithm: scan back though the styles on the previous line.
 	       a) If OFF, skip the matched group.
-	          Report a bug on failure.
+		  Report a bug on failure.
 	       b) If ON, (try to) cancel the corresponding ON at at_end,
 		  and the corresponding OFF at to;
 		  If not, put the corresponding OFF at at_end, and copy to to;
@@ -2952,6 +2952,20 @@ PRIVATE void split_line ARGS2(
 	}
     }
 
+    switch (style->alignment) {
+	case HT_CENTER :
+	    previous->offset = previous->offset + indent + spare/2;
+	    break;
+	case HT_RIGHT :
+	    previous->offset = previous->offset + indent + spare;
+	    break;
+	case HT_LEFT :
+	case HT_JUSTIFY :		/* Not implemented */
+	default:
+	    previous->offset = previous->offset + indent;
+	    break;
+    } /* switch */
+
     if (text->stbl)
 	/*
 	 *  Notify simple table stuff of line split, so that it can
@@ -2966,22 +2980,9 @@ PRIVATE void split_line ARGS2(
 	 */
 	Stbl_lineBreak(text->stbl,
 		       text->Lines - 1,
+		       previous->offset,
 		       previous->size - ctrl_chars_on_previous_line);
 
-    switch (style->alignment) {
-	case HT_CENTER :
-	    previous->offset = previous->offset + indent + spare/2;
-	    break;
-	case HT_RIGHT :
-	    previous->offset = previous->offset + indent + spare;
-	    break;
-	case HT_LEFT :
-	case HT_JUSTIFY :		/* Not implemented */
-	default:
-	    previous->offset = previous->offset + indent;
-	    break;
-    } /* switch */
-
     text->in_line_1 = NO;		/* unless caller sets it otherwise */
 
     /*
@@ -4701,7 +4702,7 @@ PUBLIC void HText_startStblTD ARGS5(
 	rowspan = 1;
     }
     if (Stbl_addCellToTable(me->stbl, colspan, rowspan, alignment, isheader,
-			    me->Lines, HText_LastLineSize(me,FALSE)) < 0)
+			    me->Lines, HText_LastLineOffset(me), HText_LastLineSize(me,FALSE)) < 0)
 	HText_cancelStbl(me);	/* give up */
 }
 
@@ -4713,7 +4714,7 @@ PUBLIC void HText_endStblTD ARGS1(
     if (!me || !me->stbl)
 	return;
     if (Stbl_finishCellInTable(me->stbl, TRST_ENDCELL_ENDTD,
-			       me->Lines, HText_LastLineSize(me,FALSE)) < 0)
+			       me->Lines, HText_LastLineOffset(me), HText_LastLineSize(me,FALSE)) < 0)
 	HText_cancelStbl(me);	/* give up */
 }
 
@@ -6053,7 +6054,8 @@ PRIVATE BOOLEAN same_anchor_or_field ARGS5(
 	return(NO);
     }
     if (formA->type != formB->type ||
-	formA->type != F_TEXTAREA_TYPE || formB->type != F_TEXTAREA_TYPE) {
+	formA->type != F_TEXTAREA_TYPE ||
+	formB->type != F_TEXTAREA_TYPE) {
 	return(NO);
     }
     if (formA->number != formB->number)
@@ -8294,6 +8296,14 @@ PUBLIC int HText_LastLineSize ARGS2(
     return HText_TrueLineSize(text->last_line, text, IgnoreSpaces);
 }
 
+PUBLIC int HText_LastLineOffset ARGS1(
+	HText *,	text)
+{
+    if (!text || !text->last_line)
+	return 0;
+    return  text->last_line->offset;
+}
+
 PUBLIC int HText_PreviousLineSize ARGS2(
 	HText *,	text,
 	BOOL,		IgnoreSpaces)
@@ -9753,7 +9763,7 @@ PUBLIC int HText_SubmitForm ARGS4(
     char *copied_val_used = NULL;
     char *copied_name_used = NULL;
 
-    CTRACE((tfp, "FIXME:SubmitForm\n"));
+    CTRACE((tfp, "SubmitForm\n  link_name=%s\n  link_value=%s\n", link_name, link_value));
     if (!HTMainText)
 	return 0;
 
@@ -9880,7 +9890,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		     p && *p && !(field_has_8bit && field_has_special);
 		     p++)
 		    if ((*p == HT_NON_BREAK_SPACE) ||
-		        (*p == HT_EN_SPACE) ||
+			(*p == HT_EN_SPACE) ||
 			(*p == LY_SOFT_HYPHEN)) {
 			field_has_special = YES;
 		    } else if ((*p & 0x80) != 0) {
@@ -10038,7 +10048,6 @@ PUBLIC int HText_SubmitForm ARGS4(
 	}
     }
 
-
     out_csname = target_csname;
 
     /*
@@ -10291,6 +10300,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		default:
 		    CTRACE((tfp, "SubmitForm: What type is %d?\n",
 				form_ptr->type));
+		    break;
 		}
 
 		switch(form_ptr->type) {
@@ -10384,7 +10394,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 		case F_IMAGE_SUBMIT_TYPE:
 		    /*
 		     *  If it has a non-zero length name (e.g., because
-		     *  it's IMAGE_SUBMIT_TYPE to be handled homologously
+		     *  its IMAGE_SUBMIT_TYPE is to be handled homologously
 		     *  to an image map, or a SUBMIT_TYPE in a set of
 		     *  multiple submit buttons, or a single type="text"
 		     *  that's been converted to a TEXT_SUBMIT_TYPE),
@@ -10571,7 +10581,7 @@ PUBLIC int HText_SubmitForm ARGS4(
 			    if (Boundary) {
 				HTSprintf(&query, "--%s\r\n", Boundary);
 			    }
-			    first_one=FALSE;
+			    first_one = FALSE;
 			} else {
 			    if (PlainText) {
 				StrAllocCat(query, "\n");
@@ -11291,11 +11301,13 @@ PRIVATE void cleanup_line_for_textarea ARGS2(
     /*
      *  Whack off trailing whitespace from the line.
      */
-    for (i = len, p = line + (len - 1); i != 0; p--, i--) {
-	if (isspace(UCH(*p)))
-	    *p = '\0';
-	else
-	    break;
+    if (LYtrimInputFields) {
+	for (i = len, p = line + (len - 1); i != 0; p--, i--) {
+	    if (isspace(UCH(*p)))
+		*p = '\0';
+	    else
+		break;
+	}
     }
 
     if (strlen (line) != 0) {
@@ -11756,7 +11768,7 @@ PRIVATE void insert_new_textarea_anchor ARGS2(
  *  --KED  02/13/99
  */
 PRIVATE void update_subsequent_anchors ARGS4(
-	int,		 n,
+	int,		 newlines,
 	TextAnchor *,	 start_anchor,
 	HTLine *,	 start_htline,
 	int,		 start_tag)
@@ -11771,7 +11783,7 @@ PRIVATE void update_subsequent_anchors ARGS4(
     int      hang_detect = 100000;  /* ditto */
 
 
-    CTRACE((tfp, "GridText: adjusting struct's to add %d new line(s)\n", n));
+    CTRACE((tfp, "GridText: adjusting struct's to add %d new line(s)\n", newlines));
 
     /*
      *  Update numeric fields of the rest of the anchors.
@@ -11785,8 +11797,8 @@ PRIVATE void update_subsequent_anchors ARGS4(
     while (anchor) {
 	if ((keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) &&
 	    (anchor->number != 0))
-	    anchor->number += n;
-	anchor->line_num  += n;
+	    anchor->number += newlines;
+	anchor->line_num  += newlines;
 	anchor = anchor->next;
     }
 
@@ -11825,7 +11837,7 @@ PRIVATE void update_subsequent_anchors ARGS4(
 	while (htline != FirstHTLine(HTMainText)) {
 
 	    while (anchor) {
-		if ((anchor->number - n) == start_tag)
+		if ((anchor->number - newlines) == start_tag)
 		    break;
 
 		/*** A HANG (infinite loop) *has* occurred here, with */
@@ -11855,7 +11867,8 @@ PRIVATE void update_subsequent_anchors ARGS4(
 
 	    if (anchor) {
 		line_adj = increment_tagged_htline (htline,  anchor,  &lx,
-						    &start_tag, n,  NOCHOP);
+						    &start_tag, newlines,
+						    NOCHOP);
 		htline->size += line_adj;
 		tag_adj      += line_adj;
 
@@ -11872,9 +11885,9 @@ finish:
     /*
      *  Fixup various global variables.
      */
-    nlinks                         += n;
-    HTMainText->Lines              += n;
-    HTMainText->last_anchor_number += n;
+    nlinks                         += newlines;
+    HTMainText->Lines              += newlines;
+    HTMainText->last_anchor_number += newlines;
 
     more = HText_canScrollDown();
 
@@ -12044,8 +12057,11 @@ PUBLIC int HText_ExtEditForm ARGS1(
     /*
      *	Nuke any blank lines from the end of the edited data.
      */
-    while ((size != 0) && (isspace(UCH(ebuf[size-1])) || (ebuf[size-1] == '\0')))
-	ebuf[--size] = '\0';
+    if (LYtrimInputFields) {
+	while ((size != 0)
+	 && (isspace(UCH(ebuf[size-1])) || (ebuf[size-1] == '\0')))
+	    ebuf[--size] = '\0';
+    }
 
     /*
      *	Copy each line from the temp file into the corresponding anchor
diff --git a/src/GridText.h b/src/GridText.h
index ad36becc..892591c7 100644
--- a/src/GridText.h
+++ b/src/GridText.h
@@ -158,6 +158,7 @@ extern BOOL HTLoadedDocumentEightbit NOPARAMS;
 extern void HText_setNodeAnchorBookmark PARAMS((CONST char *bookmark));
 extern char * HTLoadedDocumentBookmark NOPARAMS;
 extern int HText_LastLineSize PARAMS((HText *me, BOOL IgnoreSpaces));
+extern int HText_LastLineOffset PARAMS((HText *me));
 extern int HText_PreviousLineSize PARAMS((HText *me, BOOL IgnoreSpaces));
 extern void HText_NegateLineOne PARAMS((HText *text));
 extern BOOL HText_inLineOne PARAMS((HText *text));
diff --git a/src/HTML.c b/src/HTML.c
index c6ba442e..d27f1844 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -754,7 +754,7 @@ PRIVATE void LYStartArea ARGS5(
 	int,			tag_charset)
 {
     BOOL		new_present[HTML_AREA_ATTRIBUTES];
-    CONST char *		new_value[HTML_AREA_ATTRIBUTES];
+    CONST char *	new_value[HTML_AREA_ATTRIBUTES];
     int i;
 
     for (i = 0; i < HTML_AREA_ATTRIBUTES; i++)
@@ -946,20 +946,20 @@ PRIVATE int HTML_start_element ARGS6(
 	    char buf[200];
 	    CONST char* p;
 	    if (psrc_first_tag) {
-		psrc_first_tag=FALSE;
+		psrc_first_tag = FALSE;
 		/* perform the special actions on the begining of the document.
 		   It's assumed that all lynx modules start generating html
 		   from tag (ie not a text) so we are able to trap this moment
 		   and initialize.
 		*/
-		psrc_nested_call=TRUE;
-		HTML_start_element(me,HTML_BODY, NULL,NULL,tag_charset,NULL);
-		HTML_start_element(me,HTML_PRE, NULL,NULL,tag_charset,NULL);
+		psrc_nested_call = TRUE;
+		HTML_start_element(me, HTML_BODY, NULL, NULL, tag_charset, NULL);
+		HTML_start_element(me, HTML_PRE, NULL, NULL, tag_charset, NULL);
 		PSRCSTART(entire);
-		psrc_nested_call=FALSE;
+		psrc_nested_call = FALSE;
 	    }
 
-	    psrc_nested_call=TRUE;
+	    psrc_nested_call = TRUE;
 	    /*write markup for tags and exit*/
 	    PSRCSTART(abracket); PUTC('<'); PSRCSTOP(abracket);
 	    PSRCSTART(tag);
@@ -1441,7 +1441,7 @@ PRIVATE int HTML_start_element ARGS6(
 #endif /* ! USE_COLOR_STYLE */
 
 		/*
-		 *  Ignore anything not registered in the the 28-Mar-95
+		 *  Ignore anything not registered in the 28-Mar-95
 		 *  IETF HTML 3.0 draft and W3C HTML 3.2 draft, or not
 		 *  appropriate for Lynx banner links in the expired
 		 *  Maloney and Quin relrev draft.  We'll make this more
@@ -1727,8 +1727,6 @@ PRIVATE int HTML_start_element ARGS6(
 	break;
 
     case HTML_NEXTID:
-	/* if (present && present[NEXTID_N] && value[NEXTID_N])
-		HText_setNextId(me->text, atoi(value[NEXTID_N])); */
 	break;
 
     case HTML_STYLE:
@@ -6004,9 +6002,10 @@ PRIVATE int HTML_start_element ARGS6(
 	    return HT_ERROR;
 	}
 
-	CTRACE((tfp,"HTML:begin_element[%d]: adding style to stack - %s\n",
-							(int) STACKLEVEL(me),
-							NONNULL(me->new_style->name)));
+	CTRACE((tfp, "HTML:begin_element[%d]: adding style to stack - %s (%s)\n",
+		     (int) STACKLEVEL(me),
+		     NONNULL(me->new_style->name),
+		     HTML_dtd.tags[ElementNumber].name));
 	(me->sp)--;
 	me->sp[0].style = me->new_style;	/* Stack new style */
 	me->sp[0].tag_number = ElementNumber;
@@ -8116,15 +8115,9 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->base_href = NULL;
     me->map_address = NULL;
 
-    me->title.size = 0;
-    me->title.growby = 128;
-    me->title.allocated = 0;
-    me->title.data = NULL;
+    HTChunkInit(&me->title, 128);
 
-    me->object.size = 0;
-    me->object.growby = 128;
-    me->object.allocated = 0;
-    me->object.data = NULL;
+    HTChunkInit(&me->object, 128);
     me->object_started = FALSE;
     me->object_declare = FALSE;
     me->object_shapes = FALSE;
@@ -8139,19 +8132,13 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->object_usemap = NULL;
     me->object_name = NULL;
 
-    me->option.size = 0;
-    me->option.growby = 128;
-    me->option.allocated = 0;
-    me->option.data = NULL;
+    HTChunkInit(&me->option, 128);
     me->first_option = TRUE;
     me->LastOptionValue = NULL;
     me->LastOptionChecked = FALSE;
     me->select_disabled = FALSE;
 
-    me->textarea.size = 0;
-    me->textarea.growby = 128;
-    me->textarea.allocated = 0;
-    me->textarea.data = NULL;
+    HTChunkInit(&me->textarea, 128);
     me->textarea_name = NULL;
     me->textarea_name_cs = -1;
     me->textarea_accept_cs = NULL;
@@ -8160,20 +8147,11 @@ PUBLIC HTStructured* HTML_new ARGS3(
     me->textarea_disabled = NO;
     me->textarea_id = NULL;
 
-    me->math.size = 0;
-    me->math.growby = 128;
-    me->math.allocated = 0;
-    me->math.data = NULL;
+    HTChunkInit(&me->math, 128);
 
-    me->style_block.size = 0;
-    me->style_block.growby = 128;
-    me->style_block.allocated = 0;
-    me->style_block.data = NULL;
+    HTChunkInit(&me->style_block, 128);
 
-    me->script.size = 0;
-    me->script.growby = 128;
-    me->script.allocated = 0;
-    me->script.data = NULL;
+    HTChunkInit(&me->script, 128);
 
     me->text = 0;
     me->style_change = YES;	/* Force check leading to text creation */
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 8c4f6534..29b5882d 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -52,6 +52,7 @@ WINDOW *LYwin = 0;
 int LYshiftWin = 0;
 int LYwideLines = FALSE;
 int LYtableCols = 0;			/* in 1/12 of screen width */
+BOOL LYuseCursesPads = TRUE;	/* use pads for left/right shifting */
 #endif
 
 /*
@@ -950,9 +951,13 @@ PUBLIC void start_curses NOARGS
 #endif /* SIGWINCH */
 
 #ifdef USE_CURSES_PADS
-	LYwin = newpad(LYlines, MAX_COLS);
-	LYshiftWin = 0;
-	LYwideLines = FALSE;
+	if (LYuseCursesPads) {
+	    LYwin = newpad(LYlines, MAX_COLS);
+	    LYshiftWin = 0;
+	    LYwideLines = FALSE;
+	} else {
+	    LYwin = stdscr;
+	}
 #endif
 
 #if defined(USE_KEYMAPS) && defined(NCURSES_VERSION)
@@ -2210,20 +2215,6 @@ PUBLIC void LYrefresh NOARGS
 
 PUBLIC void lynx_force_repaint NOARGS
 {
-#if defined(COLOR_CURSES)
-    chtype a;
-    if (LYShowColor >= SHOW_COLOR_ON)
-	a = COLOR_BKGD;
-    else
-	a = A_NORMAL;
-    wbkgdset(LYwin, a | ' ');
-#if !defined(USE_COLOR_STYLE) && defined(NCURSES_VERSION)
-#if NCURSES_VERSION_MAJOR < 4 || (NCURSES_VERSION_MAJOR == 4 && NCURSES_VERSION_MINOR == 0)
-    wbkgd(LYwin, a | ' ');
-#endif
-#endif
-    wattrset(LYwin, a);
-#endif /* COLOR_CURSES */
     clearok(curscr, TRUE);
 }
 
diff --git a/src/LYCurses.h b/src/LYCurses.h
index 5a25d102..7a0390ce 100644
--- a/src/LYCurses.h
+++ b/src/LYCurses.h
@@ -316,6 +316,7 @@ extern WINDOW *LYwin;
 extern int LYshiftWin;
 extern int LYwideLines;
 extern int LYtableCols;
+extern BOOL LYuseCursesPads;
 #else
 #define LYwin stdscr
 #define LYshiftWin	0
diff --git a/src/LYForms.c b/src/LYForms.c
index 47538470..928b1663 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -822,6 +822,7 @@ again:
 	    HTUserMsg(FORM_TAIL_COMBINED_WITH_HEAD);
 	}
 
+	/* 2.8.4pre.3 - most browsers appear to preserve trailing spaces -VH */
 	/*
 	 *  Remove trailing spaces
 	 *
@@ -830,10 +831,12 @@ again:
 	 *  their hard earned spaces.  Better deal with trailing spaces
 	 *  when submitting the form????
 	 */
-	p = &(form->value[strlen(form->value)]);
-	while ((p != form->value) && (p[-1] == ' '))
-	    p--;
-	*p = '\0';
+	if (LYtrimInputFields) {
+	    p = &(form->value[strlen(form->value)]);
+	    while ((p != form->value) && (p[-1] == ' '))
+		p--;
+	    *p = '\0';
+	}
 
 	/*
 	 *  If the field has been changed, assume that it is now in
diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h
index 54c7413d..a800b37f 100644
--- a/src/LYGlobalDefs.h
+++ b/src/LYGlobalDefs.h
@@ -166,6 +166,7 @@ extern BOOLEAN LYforce_no_cache;
 extern BOOLEAN LYinternal_flag; /* don't need fresh copy, was internal link */
 extern BOOLEAN LYoverride_no_cache;  /* don't need fresh copy, from history */
 extern BOOLEAN LYresubmit_posts;
+extern BOOLEAN LYtrimInputFields;
 extern BOOLEAN bold_H1;
 extern BOOLEAN bold_headers;
 extern BOOLEAN bold_name_anchors;
diff --git a/src/LYMain.c b/src/LYMain.c
index 177384c6..fbf86477 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -168,6 +168,7 @@ PUBLIC BOOLEAN LYforce_no_cache = FALSE;
 PUBLIC BOOLEAN LYoverride_no_cache = FALSE;/*override no-cache b/c history etc*/
 PUBLIC BOOLEAN LYinternal_flag = FALSE; /* override no-cache b/c internal link*/
 PUBLIC BOOLEAN LYresubmit_posts = ALWAYS_RESUBMIT_POSTS;
+PUBLIC BOOLEAN LYtrimInputFields = FALSE;
 PUBLIC BOOLEAN LYUserSpecifiedURL = TRUE;/* always TRUE  the first time */
 PUBLIC BOOLEAN LYJumpFileURL = FALSE;	 /* always FALSE the first time */
 PUBLIC BOOLEAN jump_buffer = JUMPBUFFER; /* TRUE if offering default shortcut */
@@ -3197,6 +3198,10 @@ PRIVATE Config_Type Arg_Table [] =
       "cfg",		2|NEED_LYSTRING_ARG,	lynx_cfg_file,
       "=FILENAME\nspecifies a lynx.cfg file other than the default"
    ),
+   PARSE_FUN(
+      "child",		4|FUNCTION_ARG,		child_fun,
+      "exit on left-arrow in startfile, and disable save to disk"
+   ),
 #ifdef EXP_CMD_LOGGING
    PARSE_STR(
        "cmd_log",	2|NEED_LYSTRING_ARG,	lynx_cmd_logfile,
@@ -3207,10 +3212,6 @@ PRIVATE Config_Type Arg_Table [] =
        "=FILENAME\nread keystroke commands from the given file\n(see -cmd_log)"
    ),
 #endif
-   PARSE_FUN(
-      "child",		4|FUNCTION_ARG,		child_fun,
-      "exit on left-arrow in startfile, and disable save to disk"
-   ),
 #ifdef USE_SLANG
    PARSE_FUN(
       "color",		4|FUNCTION_ARG,		color_fun,
@@ -3254,6 +3255,12 @@ PRIVATE Config_Type Arg_Table [] =
       "with -traversal, output each page to a file\n\
 with -dump, format output as with -traversal, but to stdout"
    ),
+#ifdef USE_CURSES_PADS
+   PARSE_SET(
+      "curses_pads",	4|TOGGLE_ARG,		LYuseCursesPads,
+      "uses curses pad feature to support left/right shifting"
+   ),
+#endif
 #ifdef DISP_PARTIAL
    PARSE_SET(
       "debug_partial",	4|TOGGLE_ARG,		debug_display_partial,
@@ -3660,8 +3667,8 @@ treated '>' as a co-terminator for double-quotes and tags"
    ),
 #ifdef _WINDOWS
    PARSE_INT(
-      "timeout",	4|SET_ARG,		lynx_timeout,
-      "set TCP/IP timeout"
+      "timeout",	4|INT_ARG,		lynx_timeout,
+      "=NUMBER\nset TCP/IP timeout"
    ),
 #endif
    PARSE_SET(
@@ -3689,6 +3696,10 @@ treated '>' as a co-terminator for double-quotes and tags"
       "traverse all http links derived from startfile"
    ),
    PARSE_SET(
+      "trim_input_fields", 2|SET_ARG,		LYtrimInputFields,
+      "trim input text/textarea fields in forms"
+   ),
+   PARSE_SET(
       "underscore",	4|TOGGLE_ARG,		use_underscore,
       "toggles use of _underline_ format in dumps"
    ),
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 16d80296..68bbd908 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -5233,6 +5233,9 @@ PRIVATE BOOLEAN handle_LYK_LINEWRAP_TOGGLE ARGS2(
     };
     int c;
 
+    if (LYwin == stdscr)
+	return FALSE;
+
     /* Somehow the mouse is over the number instead of being over the
        name, so we decrease x. */
     c = LYChoosePopup(!LYwideLines, LYlines /2 - 2, LYcols/2-6,
diff --git a/src/LYPrettySrc.c b/src/LYPrettySrc.c
index 36b358d8..1c5a5e49 100644
--- a/src/LYPrettySrc.c
+++ b/src/LYPrettySrc.c
@@ -77,8 +77,7 @@ PRIVATE int html_src_tag_index ARGS1(
     return (tag && tag != &HTTag_unrecognized ) ? tag - HTML_dtd.tags : -1;
 }
 
-typedef enum _html_src_check_state
-{
+typedef enum {
     HTSRC_CK_normal,
     HTSRC_CK_seen_excl,
     HTSRC_CK_after_tagname,
diff --git a/src/LYPrettySrc.h b/src/LYPrettySrc.h
index 6fdda50e..59a4573f 100644
--- a/src/LYPrettySrc.h
+++ b/src/LYPrettySrc.h
@@ -24,7 +24,7 @@ extern BOOL psrc_first_tag; /* this is also used in HTML.c to trigger the
 extern BOOL mark_htext_as_source;
 
 /* here is a list of lexeme codes. */
-typedef enum _HTlexeme {
+typedef enum {
   HTL_comm=0,
   HTL_tag,
   HTL_attrib,
diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c
index 6328a52e..bb4f9191 100644
--- a/src/LYReadCFG.c
+++ b/src/LYReadCFG.c
@@ -1465,6 +1465,7 @@ PRIVATE Config_Type Config_Table [] =
 #if defined(_WINDOWS)
      PARSE_INT("timeout",              lynx_timeout),
 #endif
+     PARSE_SET("trim_input_fields",  LYtrimInputFields),
 #ifdef EXEC_LINKS
      PARSE_DEF("trusted_exec",         EXEC_PATH),
 #endif
diff --git a/src/LYStyle.c b/src/LYStyle.c
index cdcaccae..8acfaab2 100644
--- a/src/LYStyle.c
+++ b/src/LYStyle.c
@@ -1,6 +1,6 @@
 /* character level styles for Lynx
  * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-)
- * @Id: LYStyle.c 1.45 Sun, 03 Jun 2001 12:58:00 -0700 dickey @
+ * @Id: LYStyle.c 1.46 Sat, 07 Jul 2001 18:30:13 -0700 dickey @
  */
 #include <HTUtils.h>
 #include <HTML.h>
@@ -95,44 +95,56 @@ PRIVATE int colorPairs = 0;
 
 PRIVATE unsigned char our_pairs[2][MAX_BLINK][MAX_COLOR][MAX_COLOR];
 
+/*
+ * Parse a string containing a combination of video attributes and color.
+ */
+PRIVATE void parse_either ARGS4(
+    char *,	attrs,
+    int,	dft_color,
+    int *,	monop,
+    int *,	colorp)
+{
+    int value;
+
+    while (*attrs != '\0') {
+	char *next = strchr(attrs, '+');
+	char save = (next != NULL) ? *next : '\0';
+	if (next == NULL)
+	    next = attrs + strlen(attrs);
+
+	if (save != 0)	/* attrs might be a constant string */
+	    *next = '\0';
+	if ((value = string_to_attr(attrs)) != 0)
+	    *monop |= value;
+	else if (colorp != 0
+	 && (value = check_color(attrs, dft_color)) != ERR_COLOR)
+	    *colorp = value;
+
+	attrs = next;
+	if (save != '\0')
+	    *attrs++ = save;
+    }
+}
+
 /* icky parsing of the style options */
-PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element)
+PRIVATE void parse_attributes ARGS5(
+    char *,	mono,
+    char *,	fg,
+    char *,	bg,
+    int,	style,
+    char *,	element)
 {
-    int mA = 0;
-    short fA = (short) default_fg;
-    short bA = (short) default_bg;
+    int mA = A_NORMAL;
+    int fA = default_fg;
+    int bA = default_bg;
     int cA = A_NORMAL;
     int newstyle = hash_code(element);
 
-    CTRACE2(TRACE_STYLE, (tfp, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle,element));
-
-    mA = string_to_attr(mono);
-    if (!mA) {
-	/*
-	 *  Not found directly yet, see whether we have a combination
-	 *  of several mono attributes separated by '+' - kw
-	 */
-	char *cp0 = mono;
-	char csep = '+';
-	char *cp = strchr(mono, csep);
-	while (cp) {
-	    *cp = '\0';
-	    mA |= string_to_attr(cp0);
-	    if (!csep)
-		break;
-	    *cp = csep;
-	    cp0 = cp + 1;
-	    cp = strchr(cp0, csep);
-	    if (!cp) {
-		cp = cp0 + strlen(cp0);
-		csep = '\0';
-	    }
-	}
-    }
-    CTRACE2(TRACE_STYLE, (tfp, "CSS(CP):%d\n", colorPairs));
+    CTRACE2(TRACE_STYLE, (tfp, "CSS(PA):style d=%d / h=%d, e=%s\n", style, newstyle, element));
 
-    fA = (short) check_color(fg, default_fg);
-    bA = (short) check_color(bg, default_bg);
+    parse_either(mono, ERR_COLOR, &mA, (int *)0);
+    parse_either(bg, default_bg, &cA, &bA);
+    parse_either(fg, default_fg, &cA, &fA);
 
     if (style == -1) {			/* default */
 	CTRACE2(TRACE_STYLE, (tfp, "CSS(DEF):default_fg=%d, default_bg=%d\n", fA, bA));
@@ -178,7 +190,7 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*
 	    curPair = our_pairs[!!(cA & A_BOLD)][!!(cA & M_BLINK)][fA][bA] - 1;
 	else {
 	    curPair = ++colorPairs;
-	    init_pair((short) curPair, fA, bA);
+	    init_pair(curPair, fA, bA);
 	    if (fA < MAX_COLOR
 	     && bA < MAX_COLOR
 	     && curPair < 255)
diff --git a/src/TRSTable.c b/src/TRSTable.c
index f21a5012..7fbd6631 100644
--- a/src/TRSTable.c
+++ b/src/TRSTable.c
@@ -84,6 +84,13 @@ enum ended_state {
 	ROW_ended_by_splitline
 };
 
+#define HAS_END_OF_CELL			1
+#define HAS_BEG_OF_CELL			2
+#define IS_CONTINUATION_OF_CELL		4
+#define OFFSET_IS_VALID			8
+#define OFFSET_IS_VALID_LAST_CELL	0x10
+#define BELIEVE_OFFSET			0x20
+
 typedef struct _STable_rowinfo {
     /* Each row may be displayed on many display lines, but we fix up
        positions of cells on this display line only: */
@@ -113,7 +120,9 @@ typedef struct _STable_rowinfo {
        reset to the line of icell_core.
      */
 	BOOL	fixed_line;	/* if we have a 'core' line of cells */
-	BOOL	ended;		/* if we saw </tr> */
+	enum ended_state ended;	/* if we saw </tr> etc */
+	int	content;	/* Whether contains end-of-cell etc */
+	int	offset;		/* >=0 after line break in a multiline cell */
 	int	allocated;	/* number of table cells allocated */
 	STable_cellinfo * cells;
 	int	alignment;	/* global align attribute for this row */
@@ -970,6 +979,8 @@ PRIVATE int Stbl_reserveCellsInTable ARGS4(
 	for (i = 0; i < growby; i++) {
 	    row = rows + me->allocated_rows + i;
 	    row->allocated = 0;
+	    row->offset = 0;
+	    row->content = 0;
 	    if (!me->rowspans2eog.allocated) {
 		row->cells = NULL;
 	    } else {
@@ -1078,6 +1089,8 @@ PUBLIC int Stbl_addRowToTable ARGS3(
 		    row->ncells = 0;
 		    row->fixed_line = NO;
 		    row->alignment = HT_ALIGN_NONE;
+		    row->offset = 0;
+		    row->content = 0;
 		}
 	    }
 	    if (rows) {
@@ -1268,7 +1281,7 @@ PRIVATE int Stbl_fakeFinishCellInTable ARGS4(
 	   are needed. */
 	if (finishing) {
 	    /* Fake </TD> at BOL */
-	    if (Stbl_finishCellInTable(me, end_td, lineno, 0) < 0) {
+	    if (Stbl_finishCellInTable(me, end_td, lineno, 0, 0) < 0) {
 		return -1;
 	    }
 	}
@@ -1281,6 +1294,7 @@ PRIVATE int Stbl_fakeFinishCellInTable ARGS4(
 	    return -1;
 	}
 	lastrow = me->rows + (me->nrows - 1);
+	lastrow->content = IS_CONTINUATION_OF_CELL;
 	for (i = 0; i < lastrow->allocated; i++) {
 	    if (lastrow->cells[i].alignment == RESERVEDCELL) {
 		need_reserved = 1;
@@ -1355,9 +1369,10 @@ PRIVATE int Stbl_fakeFinishCellInTable ARGS4(
 	while (++i <= ncells) {
 	    /* XXXX A lot of args may be wrong... */
 	    if (Stbl_addCellToTable(me, (i==ncells ? cs : 1), rs, al,
-				    ih, lineno, 0) < 0) {
+				    ih, lineno, 0, 0) < 0) {
 		return -1;
 	    }
+	    lastrow->content &= ~HAS_BEG_OF_CELL; /* BEG_OF_CELL was fake */
 	    /* We cannot run out of width here, so it is safe to not
 	       call Stbl_finishCellInTable(), but Stbl_finishCellInRow. */
 	    if (!finishing || (i != ncells)) {
@@ -1378,13 +1393,14 @@ PRIVATE int Stbl_fakeFinishCellInTable ARGS4(
 /*
  * Returns -1 on error, otherwise 0.
  */
-PUBLIC int Stbl_addCellToTable ARGS7(
+PUBLIC int Stbl_addCellToTable ARGS8(
     STable_info *,	me,
     int,		colspan,
     int,		rowspan,
     int,		alignment,
     int,		isheader,
     int,		lineno,
+    int,		offset_not_used_yet GCC_UNUSED,
     int,		pos)
 {
     STable_states * s = &me->s;
@@ -1398,9 +1414,9 @@ PUBLIC int Stbl_addCellToTable ARGS7(
     if (!me->rows || !me->nrows)
 	return -1;		/* no row started! */
 				/* ##850_fail_if_fail?? */
-    if (me->rows[me->nrows - 1].ended)
+    if (me->rows[me->nrows - 1].ended != ROW_not_ended)
 	Stbl_addRowToTable(me, alignment, lineno);
-    Stbl_finishCellInTable(me, TRST_ENDCELL_ENDTD, lineno, pos);
+    Stbl_finishCellInTable(me, TRST_ENDCELL_ENDTD, lineno, 0, pos);
     lastrow = me->rows + (me->nrows - 1);
 
 #ifdef EXP_NESTED_TABLES
@@ -1436,6 +1452,7 @@ PUBLIC int Stbl_addCellToTable ARGS7(
 	/* me->rows may now have been realloc'd, make lastrow valid pointer */
 	lastrow = me->rows + (me->nrows - 1);
     }
+    lastrow->content |= HAS_BEG_OF_CELL;
 
     {
 	int growby = 0;
@@ -1486,10 +1503,11 @@ PUBLIC int Stbl_addCellToTable ARGS7(
 /*
  * Returns -1 on error, otherwise 0.
  */
-PUBLIC int Stbl_finishCellInTable ARGS4(
+PUBLIC int Stbl_finishCellInTable ARGS5(
     STable_info *,	me,
     int,		end_td,
     int,		lineno,
+    int,		offset,
     int,		pos)
 {
     STable_states * s = &me->s;
@@ -1498,15 +1516,15 @@ PUBLIC int Stbl_finishCellInTable ARGS4(
     int i;
 
     CTRACE2(TRACE_TRST,
-	    (tfp, "TRST:Stbl_finishCellInTable(lineno=%d, pos=%d, end_td=%d)\n",
-		  lineno, pos, (int)end_td));
+	    (tfp, "TRST:Stbl_finishCellInTable(lineno=%d, pos=%d, off=%d, end_td=%d)\n",
+		  lineno, pos, offset, (int)end_td));
     if (me->nrows == 0)
 	return -1;
     lastrow = me->rows + (me->nrows - 1);
     icell = lastrow->ncells - 1;
     if (icell < 0)
 	return icell;
-    if (s->x_td == -1) {	/* Stray </TD> or safety-call */
+    if (s->x_td == -1) {	/* Stray </TD> or just-in-case, as on </TR> */
 	if ((end_td & TRST_ENDCELL_MASK) == TRST_ENDCELL_LINEBREAK)
 	    lastrow->ended = ROW_ended_by_splitline;
 	return 0;
@@ -1570,8 +1588,12 @@ PUBLIC int Stbl_finishCellInTable ARGS4(
 	me->maxpos = me->sumcols[me->allocated_sumcols-1].pos;
     }
 
-    if ((end_td & TRST_ENDCELL_MASK) == TRST_ENDCELL_LINEBREAK)
+    if ((end_td & TRST_ENDCELL_MASK) == TRST_ENDCELL_LINEBREAK) {
 	lastrow->ended = ROW_ended_by_splitline;
+	lastrow->content |= BELIEVE_OFFSET;
+	lastrow->offset = offset;
+    }
+
 #ifdef EXP_NESTED_TABLES /* maxlen may already include contribution of a cell in this column */
     if (nested_tables) {
 	if (me->maxlen > MAX_STBL_POS)
@@ -1705,6 +1727,99 @@ PUBLIC int Stbl_finishTABLE ARGS1(
 	s->pending_len = 0;
     }
     Stbl_finishRowInTable(me);
+    /* take into account offsets on multi-line cells.
+       XXX We cannot do it honestly, since two cells on the same row may
+       participate in multi-line table entries, and we preserve only
+       one offset per row.  This implementation may ignore
+       horizontal offsets for the last row of a multirow table entry.  */
+    for (i = 0; i < me->nrows - 1; i++) {
+	int j = i + 1, leading = i, non_empty = 0;
+	STable_rowinfo *nextrow = me->rows + j;
+	int minoffset, have_offsets;
+	int foundcell = -1, max_width;
+
+	if ((nextrow->content & (IS_CONTINUATION_OF_CELL | HAS_BEG_OF_CELL | BELIEVE_OFFSET))
+	    != (IS_CONTINUATION_OF_CELL | BELIEVE_OFFSET))
+	    continue;			/* Not a continuation line */
+	minoffset = nextrow[-1].offset;	/* Line before first continuation */
+	CTRACE2(TRACE_TRST, (tfp, "TRST:Stbl_finishTABLE, l=%d, offset=%d, ended=%d.\n",
+			     i, nextrow[-1].offset, nextrow[-1].ended));
+
+	/* Find the common part of the requested offsets */
+	while (j < me->nrows
+	       && ((nextrow->content & (IS_CONTINUATION_OF_CELL | HAS_BEG_OF_CELL | BELIEVE_OFFSET))
+		   == (IS_CONTINUATION_OF_CELL | BELIEVE_OFFSET))) {
+	    if (minoffset > nextrow->offset)
+		minoffset = nextrow->offset;
+	    CTRACE2(TRACE_TRST, (tfp, "TRST:Stbl_finishTABLE, l=%d, offset=%d, ended=%d.\n",
+				 j, nextrow->offset, nextrow[-1].ended));
+	    nextrow++;
+	    j++;
+	}
+	i = j - 1;			/* Continue after this line */
+	/* Cancel the common part of offsets */
+	j = leading;			/* Restart */
+	nextrow = me->rows + j;		/* Line before first continuation */
+	have_offsets = 0;
+	nextrow->content |= OFFSET_IS_VALID_LAST_CELL;
+	while (j <= i) {		/* A continuation line */
+	    nextrow->offset -= minoffset;
+	    nextrow->content |= OFFSET_IS_VALID;
+	    if (nextrow->offset)
+		have_offsets = 1;
+	    nextrow++;
+	    j++;
+	}
+	if (!have_offsets)
+	    continue;			/* No offsets to deal with */
+
+	/* Find the cell number */
+	foundcell = -1;
+	j = leading + 1;		/* Restart */
+	nextrow = me->rows + j;		/* First continuation line */
+	while (foundcell == -1 && j <= i) { /* A continuation line */
+	    int curcell = -1;
+
+	    while (foundcell == -1 && ++curcell < nextrow->ncells)
+		if (nextrow->cells[curcell].len)
+		    foundcell = curcell, non_empty = j;
+	    nextrow++;
+	    j++;
+	}
+	if (foundcell == -1)		/* Can it happen? */
+	    continue;
+	/* Find the max width */
+	max_width = 0;
+	j = leading;			/* Restart */
+	nextrow = me->rows + j;		/* Include the pre-continuation line */
+	while (j <= i) {		/* A continuation line */
+	    if (nextrow->ncells > foundcell) {
+		int curwid = nextrow->cells[foundcell].len + nextrow->offset;
+
+		if (curwid > max_width)
+		    max_width = curwid;
+	    }
+	    nextrow++;
+	    j++;
+	}
+	/* Update the widths */
+	j = non_empty;			/* Restart from the first nonempty */
+	nextrow = me->rows + j;
+	/* Register the increase of the width */
+	update_sumcols0(me->sumcols, me->rows + non_empty,
+			0 /* width only */, max_width,
+			foundcell, nextrow->cells[foundcell].colspan,
+			me->allocated_sumcols);
+	j = leading;			/* Restart from pre-continuation */
+	nextrow = me->rows + j;
+	while (j <= i) {		/* A continuation line */
+	    if (nextrow->ncells > foundcell)
+		nextrow->cells[foundcell].len = max_width;
+	    nextrow++;
+	    j++;
+	}
+    }					/* END of Offsets processing */
+
     for (i = 0; i < me->ncols; i++) {
 	if (me->sumcols[i].pos < curpos) {
 	    me->sumcols[i].pos = curpos;
@@ -1739,6 +1854,8 @@ PRIVATE int get_fixup_positions ARGS4(
     if (!me)
 	return -1;
     while (i < me->ncells) {
+	int offset;
+
 	next_i = i + HTMAX(1, me->cells[i].colspan);
 	if (me->cells[i].cLine != me->Line) {
 	    if (me->cells[i].cLine > me->Line)
@@ -1747,7 +1864,13 @@ PRIVATE int get_fixup_positions ARGS4(
 	    continue;
 	}
 	oldpos[ip] = me->cells[i].pos;
-	newpos[ip] = sumcols[i].pos;
+	if ((me->content & OFFSET_IS_VALID)
+	    && (i == me->ncells - 1
+		|| !((me->content & OFFSET_IS_VALID_LAST_CELL))))
+	    offset = me->offset;
+	else
+	    offset = 0;
+	newpos[ip] = sumcols[i].pos + offset;
 	if ((me->cells[i].alignment == HT_CENTER ||
 	     me->cells[i].alignment == HT_RIGHT) &&
 	    me->cells[i].len > 0) {
@@ -1829,7 +1952,7 @@ PUBLIC void Stbl_update_enclosing ARGS3(
 	    max_width, me->startline, last_lineno));
     for (l = me->startline; l <= last_lineno; l++) {
 	/* Fake <BR> in appropriate positions */
-	if (Stbl_finishCellInTable(me->enclosing, TRST_ENDCELL_LINEBREAK, l, max_width) < 0) {
+	if (Stbl_finishCellInTable(me->enclosing, TRST_ENDCELL_LINEBREAK, l, 0, max_width) < 0) {
 	    /* It is not handy to let the caller delete me->enclosing,
 	       and it does not buy us anything.	 Do it directly. */
 	    STable_info *stbl = me->enclosing;
diff --git a/src/TRSTable.h b/src/TRSTable.h
index 38c496b2..8512bc2b 100644
--- a/src/TRSTable.h
+++ b/src/TRSTable.h
@@ -10,8 +10,8 @@ extern STable_info * Stbl_startTABLE PARAMS((short));
 extern int Stbl_finishTABLE PARAMS((STable_info *));
 extern void Stbl_free PARAMS((STable_info *));
 extern int Stbl_addRowToTable PARAMS((STable_info *, int, int));
-extern int Stbl_addCellToTable PARAMS((STable_info *, int, int, int, int, int, int));
-extern int Stbl_finishCellInTable PARAMS((STable_info *, int, int, int));
+extern int Stbl_addCellToTable PARAMS((STable_info *, int, int, int, int, int, int, int));
+extern int Stbl_finishCellInTable PARAMS((STable_info *, int, int, int, int));
 extern int Stbl_addColInfo PARAMS((STable_info *, int, short, BOOL));
 extern int Stbl_finishColGroup PARAMS((STable_info *));
 extern int Stbl_addRowGroup PARAMS((STable_info *, short));
@@ -20,7 +20,7 @@ extern int Stbl_addRowGroup PARAMS((STable_info *, short));
 #define TRST_ENDCELL_LINEBREAK	0
 #define TRST_ENDCELL_MASK	1
 #define TRST_FAKING_CELLS	2
-#define Stbl_lineBreak(stbl,l,pos) Stbl_finishCellInTable(stbl, TRST_ENDCELL_LINEBREAK, l, pos)
+#define Stbl_lineBreak(stbl,l,off,pos) Stbl_finishCellInTable(stbl, TRST_ENDCELL_LINEBREAK, l, off, pos)
 
 extern int Stbl_getStartLine PARAMS((STable_info *));
 extern int Stbl_getFixupPositions PARAMS((