about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2009-04-26 15:48:40 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2009-04-26 15:48:40 -0400
commit645962231e3b52eae75845c6a599048b1cbae34a (patch)
tree71562ab03750595fceb9b4db2bb5fd371476d00b /src
parent7b0f5c3465fd2b45c4eeab192e09261f9569a930 (diff)
downloadlynx-snapshots-645962231e3b52eae75845c6a599048b1cbae34a.tar.gz
snapshot of project "lynx", label v2-8-7pre_1b
Diffstat (limited to 'src')
-rw-r--r--src/AttrList.h7
-rw-r--r--src/GridText.c142
-rw-r--r--src/HTML.c46
-rw-r--r--src/LYCgi.c4
-rw-r--r--src/LYCharUtils.c24
-rw-r--r--src/LYGetFile.c4
-rw-r--r--src/LYMain.c6
-rw-r--r--src/LYUtils.c4
8 files changed, 119 insertions, 118 deletions
diff --git a/src/AttrList.h b/src/AttrList.h
index 4ef246e1..d64a7308 100644
--- a/src/AttrList.h
+++ b/src/AttrList.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: AttrList.h,v 1.15 2008/09/06 15:47:47 tom Exp $
+ * $LynxId: AttrList.h,v 1.16 2009/04/16 23:42:58 tom Exp $
  */
 #if !defined(__ATTRLIST_H)
 #define __ATTRLIST_H
@@ -37,10 +37,11 @@ extern "C" {
 	int cattr;		/* attributes to go with the color */
     } HTCharStyle;
 
+#if 0
 #define HText_characterStyle CTRACE((tfp,"HTC called from %s/%d\n",__FILE__,__LINE__));_internal_HTC
-
-#undef HText_characterStyle
+#else
 #define HText_characterStyle _internal_HTC
+#endif
 
 #if defined(USE_COLOR_STYLE)
     extern void _internal_HTC(HText *text, int style, int dir);
diff --git a/src/GridText.c b/src/GridText.c
index 13d11148..a36875ea 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.163 2009/01/02 00:18:17 tom Exp $
+ * $LynxId: GridText.c,v 1.167 2009/04/26 13:05:17 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -46,6 +46,13 @@
 #include <LYLeaks.h>
 
 /*#define DEBUG_APPCH 1*/
+/*#define DEBUG_STYLE 1*/
+
+#ifdef DEBUG_STYLE
+#define CTRACE_STYLE(p) CTRACE2(TRACE_STYLE, p)
+#else
+#define CTRACE_STYLE(p)		/* nothing */
+#endif
 
 #ifdef USE_COLOR_STYLE
 #include <AttrList.h>
@@ -170,9 +177,9 @@ static void *LY_check_calloc(size_t nmemb, size_t size);
 #endif
 
 typedef struct {
-    unsigned int direction:2;	/* on or off */
-    unsigned int horizpos:14;	/* horizontal position of this change */
-    unsigned int style:16;	/* which style to change to */
+    unsigned int sc_direction:2;	/* on or off */
+    unsigned int sc_horizpos:14;	/* horizontal position of this change */
+    unsigned int sc_style:16;	/* which style to change to */
 } HTStyleChange;
 
 #if defined(USE_COLOR_STYLE)
@@ -731,7 +738,7 @@ static void *LY_check_calloc(size_t nmemb, size_t size)
 static int StyleToCols(HText *text, HTLine *line, int nstyle)
 {
     int result = line->offset;	/* this much is spaces one byte/cell */
-    int nchars = line->styles[nstyle].horizpos;
+    int nchars = line->styles[nstyle].sc_horizpos;
     char *data = line->data;
     char *last = line->size + data;
     int utf_extra;
@@ -1465,8 +1472,8 @@ static int display_line(HTLine *line,
 #define CStyle line->styles[current_style]
 
 	while (current_style < line->numstyles &&
-	       i >= (int) (CStyle.horizpos + line->offset + 1)) {
-	    LynxChangeStyle(CStyle.style, CStyle.direction);
+	       i >= (int) (CStyle.sc_horizpos + line->offset + 1)) {
+	    LynxChangeStyle(CStyle.sc_style, CStyle.sc_direction);
 	    current_style++;
 	}
 #endif
@@ -1540,7 +1547,7 @@ static int display_line(HTLine *line,
 		LastDisplayChar == '-') {
 		/*
 		 * Ignore the soft hyphen if it is not the last character in
-		 * the line.  Also ignore it if it first character following
+		 * the line.  Also ignore it if is first character following
 		 * the margin, or if it is preceded by a white character (we
 		 * loaded 'M' into LastDisplayChar if it was a multibyte
 		 * character) or hyphen, though it should have been excluded by
@@ -1643,7 +1650,7 @@ static int display_line(HTLine *line,
     lynx_stop_bold();
 #else
     while (current_style < line->numstyles) {
-	LynxChangeStyle(CStyle.style, CStyle.direction);
+	LynxChangeStyle(CStyle.sc_style, CStyle.sc_direction);
 	current_style++;
     }
 #undef CStyle
@@ -2719,10 +2726,10 @@ static HTLine *insert_blanks_in_line(HTLine *line, int line_number,
 #if defined(USE_COLOR_STYLE)	/* Move styles too */
 #define NStyle mod_line->styles[istyle]
 	for (;
-	     istyle < line->numstyles && (int) NStyle.horizpos < curlim;
+	     istyle < line->numstyles && (int) NStyle.sc_horizpos < curlim;
 	     istyle++)
 	    /* Should not we include OFF-styles at curlim? */
-	    NStyle.horizpos += shift;
+	    NStyle.sc_horizpos += shift;
 #endif
 	while (copied < pre)	/* Copy verbatim to byte == pre */
 	    *t++ = *copied++;
@@ -2764,24 +2771,36 @@ static HTStyleChange *skip_matched_and_correct_offsets(HTStyleChange *end,
 						       HTStyleChange *start,
 						       unsigned split_pos)
 {
+    HTStyleChange *result = 0;
     int level = 0;
     HTStyleChange *tmp = end;
 
+    CTRACE_STYLE((tfp, "SKIP Style %d %d (%d)\n",
+		  tmp->sc_horizpos,
+		  tmp->sc_style,
+		  tmp->sc_direction));
     for (; tmp >= start; tmp--) {
-	if (tmp->style == end->style) {
-	    if (tmp->direction == STACK_OFF)
+	CTRACE_STYLE((tfp, "... %d %d (%d)\n",
+		      tmp->sc_horizpos,
+		      tmp->sc_style,
+		      tmp->sc_direction));
+	if (tmp->sc_style == end->sc_style) {
+	    if (tmp->sc_direction == STACK_OFF) {
 		level--;
-	    else if (tmp->direction == STACK_ON) {
-		if (++level == 0)
-		    return tmp;
-	    } else
-		return 0;
+	    } else if (tmp->sc_direction == STACK_ON) {
+		if (++level == 0) {
+		    result = tmp;
+		    break;
+		}
+	    } else {
+		break;
+	    }
 	}
-	if (tmp->horizpos > split_pos) {
-	    tmp->horizpos = split_pos;
+	if (tmp->sc_horizpos > split_pos) {
+	    tmp->sc_horizpos = split_pos;
 	}
     }
-    return 0;
+    return result;
 }
 #endif /* USE_COLOR_STYLE */
 
@@ -3030,12 +3049,12 @@ static void split_line(HText *text, unsigned split)
 	 * The second loop below may then handle remaining changes.  - kw */
 	while (from >= previous->styles && to >= line->styles) {
 	    *to = *from;
-	    if ((int) to->horizpos > s_post) {
-		to->horizpos += -s_post + SpecialAttrChars;
-	    } else if ((int) to->horizpos > s_pre &&
-		       (to->direction == STACK_ON ||
-			to->direction == ABS_ON)) {
-		to->horizpos = ((int) to->horizpos < s) ? 0 : SpecialAttrChars;
+	    if ((int) to->sc_horizpos > s_post) {
+		to->sc_horizpos += -s_post + SpecialAttrChars;
+	    } else if ((int) to->sc_horizpos > s_pre &&
+		       (to->sc_direction == STACK_ON ||
+			to->sc_direction == ABS_ON)) {
+		to->sc_horizpos = ((int) to->sc_horizpos < s) ? 0 : SpecialAttrChars;
 	    } else {
 		break;
 	    }
@@ -3059,43 +3078,49 @@ static void split_line(HText *text, unsigned split)
 	       and the corresponding OFF at to;
 	       If not, put the corresponding OFF at at_end, and copy to to;
 	     */
-	    if (scan->direction == STACK_OFF) {
+	    if (scan->sc_direction == STACK_OFF) {
 		scan = skip_matched_and_correct_offsets(scan, previous->styles,
 							s_pre);
 		if (!scan) {
 		    CTRACE((tfp, "BUG: styles improperly nested.\n"));
 		    break;
 		}
-	    } else if (scan->direction == STACK_ON) {
-		if (at_end->direction == STACK_ON
-		    && at_end->style == scan->style
-		    && (int) at_end->horizpos >= s_pre)
+	    } else if (scan->sc_direction == STACK_ON) {
+		if (at_end->sc_direction == STACK_ON
+		    && at_end->sc_style == scan->sc_style
+		    && (int) at_end->sc_horizpos >= s_pre)
 		    at_end--;
 		else if (at_end >= previous->styles + MAX_STYLES_ON_LINE - 1) {
 		    CTRACE((tfp, "BUG: style overflow before split_line.\n"));
 		    break;
 		} else {
 		    at_end++;
-		    at_end->direction = STACK_OFF;
-		    at_end->style = scan->style;
-		    at_end->horizpos = s_pre;
+		    at_end->sc_direction = STACK_OFF;
+		    at_end->sc_style = scan->sc_style;
+		    at_end->sc_horizpos = s_pre;
+		    CTRACE_STYLE((tfp,
+				  "split_line, %d:style[%d] %d (dir=%d)\n",
+				  s_pre,
+				  at_end - from,
+				  scan->sc_style,
+				  at_end->sc_direction));
 		}
 		if (to < line->styles + MAX_STYLES_ON_LINE - 1
-		    && to[1].direction == STACK_OFF
-		    && to[1].horizpos <= (unsigned) SpecialAttrChars
-		    && to[1].style == scan->style)
+		    && to[1].sc_direction == STACK_OFF
+		    && to[1].sc_horizpos <= (unsigned) SpecialAttrChars
+		    && to[1].sc_style == scan->sc_style)
 		    to++;
 		else if (to >= line->styles) {
 		    *to = *scan;
-		    to->horizpos = SpecialAttrChars;
+		    to->sc_horizpos = SpecialAttrChars;
 		    to--;
 		} else {
 		    CTRACE((tfp, "BUG: style overflow after split_line.\n"));
 		    break;
 		}
 	    }
-	    if ((int) scan->horizpos > s_pre) {
-		scan->horizpos = s_pre;
+	    if ((int) scan->sc_horizpos > s_pre) {
+		scan->sc_horizpos = s_pre;
 	    }
 	    scan--;
 	}
@@ -3106,11 +3131,11 @@ static void split_line(HText *text, unsigned split)
 	    for (n = 0; n < line->numstyles; n++)
 		line->styles[n] = to[n + 1];
 	} else if (line->numstyles == 0) {
-	    line->styles[0].horizpos = ~0;	/* ?!!! */
+	    line->styles[0].sc_horizpos = ~0;	/* ?!!! */
 	}
 	previous->numstyles = at_end - previous->styles + 1;
 	if (previous->numstyles == 0) {
-	    previous->styles[0].horizpos = ~0;	/* ?!!! */
+	    previous->styles[0].sc_horizpos = ~0;	/* ?!!! */
 	}
     }
 #endif /*USE_COLOR_STYLE */
@@ -4498,9 +4523,9 @@ void _internal_HTC(HText *text, int style, int dir)
 	line = text->last_line;
 
 	if (line->numstyles > 0 && dir == 0 &&
-	    line->styles[line->numstyles - 1].direction &&
-	    line->styles[line->numstyles - 1].style == (unsigned) style &&
-	    (int) line->styles[line->numstyles - 1].horizpos
+	    line->styles[line->numstyles - 1].sc_direction &&
+	    line->styles[line->numstyles - 1].sc_style == (unsigned) style &&
+	    (int) line->styles[line->numstyles - 1].sc_horizpos
 	    == (int) line->size - ctrl_chars_on_this_line) {
 	    /*
 	     * If this is an OFF change directly preceded by an
@@ -4508,18 +4533,23 @@ void _internal_HTC(HText *text, int style, int dir)
 	     */
 	    line->numstyles--;
 	} else if (line->numstyles < MAX_STYLES_ON_LINE) {
-	    line->styles[line->numstyles].horizpos = line->size;
+	    line->styles[line->numstyles].sc_horizpos = line->size;
 	    /*
 	     * Special chars for bold and underlining usually don't
 	     * occur with color style, but soft hyphen can.
 	     * And in UTF-8 display mode all non-initial bytes are
 	     * counted as ctrl_chars.  - kw
 	     */
-	    if ((int) line->styles[line->numstyles].horizpos >= ctrl_chars_on_this_line) {
-		line->styles[line->numstyles].horizpos -= ctrl_chars_on_this_line;
-	    }
-	    line->styles[line->numstyles].style = style;
-	    line->styles[line->numstyles].direction = dir;
+	    if ((int) line->styles[line->numstyles].sc_horizpos >= ctrl_chars_on_this_line) {
+		line->styles[line->numstyles].sc_horizpos -= ctrl_chars_on_this_line;
+	    }
+	    line->styles[line->numstyles].sc_style = style;
+	    line->styles[line->numstyles].sc_direction = dir;
+	    CTRACE_STYLE((tfp, "internal_HTC %d:style[%d] %d (dir=%d)\n",
+			  line->size,
+			  line->numstyles,
+			  style,
+			  dir));
 	    line->numstyles++;
 	}
     }
@@ -6403,13 +6433,13 @@ static BOOLEAN same_anchor_or_field(int numberA,
     return (BOOL) (strcmp(formA->name, formB->name) == 0);
 }
 
-#define same_anchor_as_link(i,a,ta_same) (i >= 0 && a &&\
+#define same_anchor_as_link(i,a,ta_same) (BOOL) (i >= 0 && a && \
 		same_anchor_or_field(links[i].anchor_number,\
 		(links[i].type == WWW_FORM_LINK_TYPE) ? links[i].l_form : NULL,\
 		a->number,\
 		(a->link_type == INPUT_ANCHOR) ? a->input_field : NULL,\
 		ta_same))
-#define same_anchors(a1,a2,ta_same) (a1 && a2 &&\
+#define same_anchors(a1,a2,ta_same) (BOOL) (a1 && a2 && \
 		same_anchor_or_field(a1->number,\
 		(a1->link_type == INPUT_ANCHOR) ? a1->input_field : NULL,\
 		a2->number,\
@@ -13296,7 +13326,7 @@ static void redraw_part_of_line(HTLine *line, const char *str,
 
 	while (current_style < line->numstyles &&
 	       tcols >= scols) {
-	    LynxChangeStyle(CStyle.style, CStyle.direction);
+	    LynxChangeStyle(CStyle.sc_style, CStyle.sc_direction);
 	    current_style++;
 	    scols = StyleToCols(text, line, current_style);
 	}
@@ -13410,7 +13440,7 @@ static void redraw_part_of_line(HTLine *line, const char *str,
 #else
 
     while (current_style < line->numstyles) {
-	LynxChangeStyle(CStyle.style, CStyle.direction);
+	LynxChangeStyle(CStyle.sc_style, CStyle.sc_direction);
 	current_style++;
     }
 
diff --git a/src/HTML.c b/src/HTML.c
index f1de8177..2c841265 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.118 2009/01/01 23:08:07 tom Exp $
+ * $LynxId: HTML.c,v 1.121 2009/04/16 23:38:37 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -1136,7 +1136,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
     }
 #endif /* !OMIT_SCN_KEEPING */
 
-    HText_characterStyle(me->text, hcode, 1);
+    HText_characterStyle(me->text, hcode, STACK_ON);
 #endif /* USE_COLOR_STYLE */
 
     /*
@@ -1533,12 +1533,12 @@ static int HTML_start_element(HTStructured * me, int element_number,
 		CTRACE2(TRACE_STYLE,
 			(tfp, "STYLE.link: using style <%s>\n", tmp));
 
-		HText_characterStyle(me->text, hash_code(tmp), 1);
+		HText_characterStyle(me->text, hash_code(tmp), STACK_ON);
 		HTML_put_string(me, title);
 		HTML_put_string(me, " (");
 		HTML_put_string(me, value[HTML_LINK_CLASS]);
 		HTML_put_string(me, ")");
-		HText_characterStyle(me->text, hash_code(tmp), 0);
+		HText_characterStyle(me->text, hash_code(tmp), STACK_OFF);
 		FREE(tmp);
 	    } else
 #endif
@@ -2785,7 +2785,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	UPDATE_STYLE;
 	if (me->sp->tag_number == (int) ElementNumber)
 	    LYEnsureDoubleSpace(me);
-	CHECK_ID(HTML_FN_ID);
+	CHECK_ID(HTML_GEN_ID);
 	if (me->inUnderline == FALSE)
 	    HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
 	HTML_put_string(me, "FOOTNOTE:");
@@ -4089,7 +4089,7 @@ static int HTML_start_element(HTStructured * me, int element_number,
 	LYEnsureDoubleSpace(me);
 	LYResetParagraphAlignment(me);
 	me->inCREDIT = TRUE;
-	CHECK_ID(HTML_CREDIT_ID);
+	CHECK_ID(HTML_GEN_ID);
 	if (me->inUnderline == FALSE)
 	    HText_appendCharacter(me->text, LY_UNDERLINE_START_CHAR);
 	HTML_put_string(me, "CREDIT:");
@@ -4269,13 +4269,13 @@ static int HTML_start_element(HTStructured * me, int element_number,
     case HTML_FIELDSET:
 	LYEnsureDoubleSpace(me);
 	LYResetParagraphAlignment(me);
-	CHECK_ID(HTML_FIELDSET_ID);
+	CHECK_ID(HTML_GEN_ID);
 	break;
 
     case HTML_LEGEND:
 	LYEnsureDoubleSpace(me);
 	LYResetParagraphAlignment(me);
-	CHECK_ID(HTML_LEGEND_ID);
+	CHECK_ID(HTML_CAPTION_ID);
 	break;
 
     case HTML_LABEL:
@@ -4954,19 +4954,6 @@ static int HTML_start_element(HTStructured * me, int element_number,
 
     case HTML_TEXTAREA:
 	/*
-	 * Make sure we're in a form.
-	 */
-	if (!me->inFORM) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: TEXTAREA start tag not within FORM tag\n"));
-	    /*
-	     * Too likely to cause a crash, so we'll ignore it.  - FM
-	     */
-	    break;
-	}
-
-	/*
 	 * Set to know we are in a textarea.
 	 */
 	me->inTEXTAREA = TRUE;
@@ -6968,7 +6955,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 
     case HTML_SELECT:
 	{
-	    char *ptr;
+	    char *ptr = NULL;
 
 	    /*
 	     * Make sure we had a select start tag.
@@ -7008,13 +6995,14 @@ static int HTML_end_element(HTStructured * me, int element_number,
 	    /*
 	     * Finish the previous option.
 	     */
-	    ptr = HText_setLastOptionValue(me->text,
-					   me->option.data,
-					   me->LastOptionValue,
-					   LAST_ORDER,
-					   me->LastOptionChecked,
-					   me->UCLYhndl,
-					   ATTR_CS_IN);
+	    if (!me->first_option)
+		ptr = HText_setLastOptionValue(me->text,
+					       me->option.data,
+					       me->LastOptionValue,
+					       LAST_ORDER,
+					       me->LastOptionChecked,
+					       me->UCLYhndl,
+					       ATTR_CS_IN);
 	    FREE(me->LastOptionValue);
 
 	    me->LastOptionChecked = FALSE;
diff --git a/src/LYCgi.c b/src/LYCgi.c
index fbd4822e..cfaf18fb 100644
--- a/src/LYCgi.c
+++ b/src/LYCgi.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCgi.c,v 1.55 2009/03/10 00:05:59 tom Exp $
+ * $LynxId: LYCgi.c,v 1.56 2009/04/12 17:14:41 tom Exp $
  *                   Lynx CGI support                              LYCgi.c
  *                   ================
  *
@@ -167,7 +167,7 @@ static BOOL can_exec_cgi(const char *linktext, const char *linkargs)
     if (!exec_ok(HTLoadedDocumentURL(), linktext, CGI_PATH)) {
 	/* exec_ok gives out msg. */
 	result = FALSE;
-    } else if (user_mode < ADVANCED_MODE) {
+    } else {
 	StrAllocCopy(command, linktext);
 	if (non_empty(linkargs)) {
 	    HTSprintf(&command, " %s", linkargs);
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index 9ecb3dff..f085171a 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharUtils.c,v 1.96 2009/01/19 23:56:35 tom Exp $
+ * $LynxId: LYCharUtils.c,v 1.98 2009/04/09 20:38:13 tom Exp $
  *
  *  Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM
  *  ==========================================================================
@@ -246,7 +246,7 @@ static BOOL MustEntify(const char *source)
 	size_t length = strlen(source);
 	size_t reject = strcspn(source, "<&>");
 
-	result = (length != reject);
+	result = (BOOL) (length != reject);
     }
 
     return result;
@@ -2866,26 +2866,6 @@ void LYHandleSELECT(HTStructured * me, const BOOL *present,
 	me->select_disabled = FALSE;
 
 	/*
-	 * Make sure we're in a form.
-	 */
-	if (!me->inFORM) {
-	    if (LYBadHTML(me))
-		CTRACE((tfp,
-			"Bad HTML: SELECT start tag not within FORM tag\n"));
-
-	    /*
-	     * We should have covered all crash possibilities with the current
-	     * TagSoup parser, so we'll allow it because some people with other
-	     * browsers use SELECT for "information" popups, outside of FORM
-	     * blocks, though no Lynx user would do anything that awful, right? 
-	     * - FM
-	     */
-	       /***
-	    return;
-		***/
-	}
-
-	/*
 	 * Check for unclosed TEXTAREA.
 	 */
 	if (me->inTEXTAREA) {
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index 53b48170..dac1f916 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYGetFile.c,v 1.78 2008/01/08 00:19:25 tom Exp $ */
+/* $LynxId: LYGetFile.c,v 1.79 2009/04/12 17:24:06 tom Exp $ */
 #include <HTUtils.h>
 #include <HTTP.h>
 #include <HTAnchor.h>		/* Anchor class */
@@ -1265,7 +1265,7 @@ static struct trust always_trusted_exec_default =
 };
 static struct trust trusted_cgi_default =
 {
-    "", "", CGI_PATH, NULL
+    "none", "", CGI_PATH, NULL
 };
 
 static struct trust *trusted_exec = &trusted_exec_default;
diff --git a/src/LYMain.c b/src/LYMain.c
index 40f1833c..399bc529 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.199 2009/04/07 00:10:20 tom Exp $
+ * $LynxId: LYMain.c,v 1.200 2009/04/12 16:57:48 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -4149,6 +4149,7 @@ static BOOL parse_arg(char **argv,
 
 #if EXTENDED_STARTFILE_RECALL
     static BOOLEAN no_options_further = FALSE;	/* set to TRUE after '--' argument */
+    static int nof_index = 0;	/* set the index of -- argument */
 #endif
 
     arg_name = argv[0];
@@ -4170,7 +4171,7 @@ static BOOL parse_arg(char **argv,
      */
     if (*arg_name != '-'
 #if EXTENDED_OPTION_LOGIC
-	|| no_options_further == TRUE
+	|| (no_options_further == TRUE && nof_index < (*countp))
 #endif
 	) {
 #if EXTENDED_STARTFILE_RECALL
@@ -4206,6 +4207,7 @@ static BOOL parse_arg(char **argv,
 #if EXTENDED_OPTION_LOGIC
     if (strcmp(arg_name, "--") == 0) {
 	no_options_further = TRUE;
+	nof_index = *countp;
 	return TRUE;
     }
 #endif
diff --git a/src/LYUtils.c b/src/LYUtils.c
index e55bcc11..c9688d90 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.183 2009/03/17 00:40:24 tom Exp $
+ * $LynxId: LYUtils.c,v 1.184 2009/04/09 20:33:31 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -1161,7 +1161,7 @@ void LYhighlight(int flag,
 	    gllen = LYmbcsstrlen(text, utf_flag, YES);
 	    len = LYmbcs_skip_cells(text, avail_space, utf_flag) - text;
 	    LYwaddnstr(LYwin, text, (unsigned) len);
-	    while (gllen++ < avail_space)
+	    while (len++ < avail_space)
 		LYaddch('_');
 
 #ifdef USE_COLOR_STYLE