mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
If the user edits a textarea with an external editor but exceeds the
maximum length, do not simply drop the changes, but instead truncate them, warn the user, and provide the user with the path to the temporary file from which the full changes can be recovered.
This commit is contained in:
parent
69f38bcbcc
commit
d11dc65320
@ -381,13 +381,23 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
|
||||
}
|
||||
|
||||
if (file.length > fc_maxlength) {
|
||||
done_string(&file);
|
||||
textarea_editor = 0;
|
||||
goto free_and_return;
|
||||
file.source[fc_maxlength] = '\0';
|
||||
info_box(term, MSGBOX_FREE_TEXT, N_("Warning"),
|
||||
ALIGN_CENTER,
|
||||
msg_text(term,
|
||||
N_("You have exceeded the textarea's"
|
||||
" size limit: your input is %d"
|
||||
" bytes, but the maximum is %u"
|
||||
" bytes.\n\n"
|
||||
"Your input has been truncated,"
|
||||
" but you can still recover the"
|
||||
" text that you entered from"
|
||||
" this file: %s"), file.length,
|
||||
fc_maxlength, fn));
|
||||
} else {
|
||||
unlink(fn);
|
||||
}
|
||||
|
||||
unlink(fn);
|
||||
|
||||
mem_free(fs->value);
|
||||
fs->value = file.source;
|
||||
fs->state = file.length;
|
||||
|
Loading…
Reference in New Issue
Block a user