mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Bug 620: Reset form fields to default values on reload
Do not retain changed values in form fields when the user reloads. Doing so can be confusing or even cause data-loss when new default values are specified in the updated document. For example, when editing an article on Wikipedia, one loads the edit page for the article, makes and submits changes, goes back to the edit page to make further modifications, and reloads to get the new article text. Before this change, reloading the edit page would not update the textarea on the page with the new article source, which can lead one (and has led me) to make changes to the original version of the article by accident. This fixes bug 620. (cherry picked from commit 9e1e94bee0da92a9b753e211f798b22e93713e95)
This commit is contained in:
parent
c2cf48f9e6
commit
0b99fa70ca
@ -36,6 +36,7 @@
|
||||
#include "util/error.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/string.h"
|
||||
#include "viewer/text/form.h"
|
||||
#include "viewer/text/view.h"
|
||||
#include "viewer/text/vs.h"
|
||||
|
||||
@ -334,6 +335,11 @@ render_document(struct view_state *vs, struct document_view *doc_view,
|
||||
if (!document) return;
|
||||
doc_view->document = document;
|
||||
|
||||
if (doc_view->session
|
||||
&& doc_view->session->reloadlevel > CACHE_MODE_NORMAL)
|
||||
while (vs->form_info_len)
|
||||
mem_free_if(vs->form_info[--vs->form_info_len].value);
|
||||
|
||||
shrink_memory(0);
|
||||
|
||||
render_encoded_document(cached, document);
|
||||
|
Loading…
x
Reference in New Issue
Block a user