mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Apply form history to fs->value, not fc->default_value.
I am going make fc->default_value use the charset of the document, and recoding the string from the form history to that might lose characters. This change also affects what ECMAScript sees in the defaultValue property. <http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-26091157> says it should represent the HTML "value" attribute, so changing it based on form history is not appropriate.
This commit is contained in:
parent
3918c8ef1c
commit
ec5d0cf0a7
@ -161,9 +161,16 @@ init_form_state(struct form_control *fc, struct form_state *fs)
|
|||||||
switch (fc->type) {
|
switch (fc->type) {
|
||||||
case FC_TEXT:
|
case FC_TEXT:
|
||||||
case FC_PASSWORD:
|
case FC_PASSWORD:
|
||||||
|
#ifdef CONFIG_FORMHIST
|
||||||
|
fs->value = null_or_stracpy(
|
||||||
|
get_form_history_value(
|
||||||
|
fc->form->action, fc->name));
|
||||||
|
#endif /* CONFIG_FORMHIST */
|
||||||
|
/* fall through */
|
||||||
case FC_TEXTAREA:
|
case FC_TEXTAREA:
|
||||||
fs->value = stracpy(fc->default_value);
|
if (fs->value == NULL)
|
||||||
fs->state = strlen(fc->default_value);
|
fs->value = stracpy(fc->default_value);
|
||||||
|
fs->state = fs->value ? strlen(fs->value) : 0;
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
if (fc->type == FC_TEXTAREA)
|
if (fc->type == FC_TEXTAREA)
|
||||||
fs->state_cell = 0;
|
fs->state_cell = 0;
|
||||||
@ -578,18 +585,6 @@ draw_forms(struct terminal *term, struct document_view *doc_view)
|
|||||||
struct form_control *fc = get_link_form_control(l1);
|
struct form_control *fc = get_link_form_control(l1);
|
||||||
|
|
||||||
if (!fc) continue;
|
if (!fc) continue;
|
||||||
#ifdef CONFIG_FORMHIST
|
|
||||||
if (fc->type == FC_TEXT || fc->type == FC_PASSWORD) {
|
|
||||||
unsigned char *value;
|
|
||||||
|
|
||||||
assert(fc->form);
|
|
||||||
value = get_form_history_value(fc->form->action, fc->name);
|
|
||||||
|
|
||||||
if (value)
|
|
||||||
mem_free_set(&fc->default_value,
|
|
||||||
stracpy(value));
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_FORMHIST */
|
|
||||||
draw_form_entry(term, doc_view, l1);
|
draw_form_entry(term, doc_view, l1);
|
||||||
|
|
||||||
} while (l1++ < l2);
|
} while (l1++ < l2);
|
||||||
|
Loading…
Reference in New Issue
Block a user