[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV the printing function and submit/image/reset buttons
From: |
Laura Eaves |
Subject: |
LYNX-DEV the printing function and submit/image/reset buttons |
Date: |
Mon, 7 Apr 1997 16:27:59 -0400 (EDT) |
Last month I posted mail about the problem of lynx translating
submit/image/reset buttons into underscores when printing a rendered page,
whether or not they have alt or value strings defined.
Below are some minor changes to GridText.c and HTML.c that correct the problem.
I assume this is a safe fix, since the "value" of these fields never change
(or do they?????). Assuming they don't, there's no need to suppress their
default value.
The diff is against GridText from 2.7.1, and
HTML.c from 2.7.1 + Fote's form bug patch.
Let me know if there's any reason not to make this change.
Thanks.
--le
diff -c old/GridText.c src/GridText.c
*** old/GridText.c Mon Apr 7 06:39:30 1997
--- src/GridText.c Mon Apr 7 16:11:27 1997
***************
*** 3924,3931 ****
StrAllocCopy(f->value, "[IMAGE]-Submit");
f->size = 14;
} else {
- StrAllocCopy(f->value, "[IMAGE]-Submit");
- f->size = 14;
StrAllocCopy(f->value, "Submit");
f->size = 6;
}
--- 3924,3929 ----
***************
*** 3976,3981 ****
--- 3974,3990 ----
((f->value != NULL) ? f->value : ""),
f->size);
+ /*
+ * Save value for submit/reset buttons so they will be visible when
printing
+ * the page. --LE
+ */
+ switch ( f->type ) {
+ case F_SUBMIT_TYPE:
+ case F_IMAGE_SUBMIT_TYPE:
+ case F_RESET_TYPE:
+ I->value = f->value;
+ }
+
/*
* Return the SIZE of the input field.
*/
diff -c fm/HTML.c src/HTML.c
*** fm/HTML.c Mon Apr 7 07:08:20 1997
--- src/HTML.c Mon Apr 7 16:06:26 1997
***************
*** 3555,3560 ****
--- 3555,3561 ----
int chars;
BOOL UseALTasVALUE = FALSE;
BOOL HaveSRClink = FALSE;
+ BOOL is_submit_or_reset = 0; /*--LE*/
/*
* Make sure we're in a form.
***************
*** 3818,3824 ****
I.md = (char *)value[HTML_INPUT_MD];
chars = HText_beginInput(me->text, &I);
! if (me->sp[0].tag_number == HTML_PRE && chars > 20) {
/*
* The code inadequately handles INPUT fields in PRE tags.
* We'll put up a minimum of 20 underscores, and if any
--- 3819,3836 ----
I.md = (char *)value[HTML_INPUT_MD];
chars = HText_beginInput(me->text, &I);
! /*
! * Value for submit and reset buttons saved in I by
! * HText_beginInput(), so it can be output correctly during
! * print operations. --LE
! */
! if ( I.type &&
! ( !strcasecomp(I.type,"submit")
! || !strcasecomp(I.type,"reset")
! || !strcasecomp(I.type,"image") ) )
! is_submit_or_reset = 1;
! if (me->sp[0].tag_number == HTML_PRE && chars > 20
! && !is_submit_or_reset) {
/*
* The code inadequately handles INPUT fields in PRE tags.
* We'll put up a minimum of 20 underscores, and if any
***************
*** 3830,3837 ****
}
HText_setIgnoreExcess(me->text, TRUE);
}
! for (; chars > 0; chars--)
! HTML_put_character(me, '_');
HText_setIgnoreExcess(me->text, FALSE);
}
break;
--- 3842,3855 ----
}
HText_setIgnoreExcess(me->text, TRUE);
}
! /*--LE*/
! if ( !is_submit_or_reset ) {
! for (; chars > 0; chars--)
! HTML_put_character(me, '_');
! } else { int i;
! for ( i = 0; i < chars; ++i )
! HTML_put_character(me, I.value[i]);
! }
HText_setIgnoreExcess(me->text, FALSE);
}
break;
***************
*** 4286,4292 ****
char *temp = NULL, *cp = NULL;
#ifdef CAREFUL /* parser assumed to produce good
nesting */
! if (element_number != me->sp[0].tag_number) {
fprintf(stderr,
"HTMLText: end of element %s when expecting end of %s\n",
HTML_dtd.tags[element_number].name,
--- 4304,4310 ----
char *temp = NULL, *cp = NULL;
#ifdef CAREFUL /* parser assumed to produce good
nesting */
! if (element_number != me->sp[0].tag_number && element_number !=
HTML_FORM) {
fprintf(stderr,
"HTMLText: end of element %s when expecting end of %s\n",
HTML_dtd.tags[element_number].name,
***************
*** 4320,4326 ****
fprintf(stderr,
"Stack underflow error! Tried to pop off more styles than exist in
stack\n");
}
! }
/*
* Check for unclosed TEXTAREA. - FM
--- 4338,4344 ----
fprintf(stderr,
"Stack underflow error! Tried to pop off more styles than exist in
stack\n");
}
! } else if ( TRACE ) fprintf(stderr,"HTML:end_element: end form\n");
/*
* Check for unclosed TEXTAREA. - FM
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;
- LYNX-DEV the printing function and submit/image/reset buttons,
Laura Eaves <=