1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

[scripting] Added the "document.scripting.sleep_on_error" boolean option. Refs #319

When enabled elinks sleeps 3 seconds in case of error without terminal.
Enabled is the default.
This commit is contained in:
Witold Filipczyk 2024-08-26 20:14:51 +02:00
parent 715d6bc39a
commit 5b93d9bb89

View File

@ -44,7 +44,10 @@ report_scripting_error(struct module *module, struct session *ses,
if (term == NULL) {
usrerror(gettext("[%s error] %s"),
gettext(module->name), msg);
sleep(3);
if (get_opt_bool("document.scripting.sleep_on_error", NULL)) {
sleep(3);
}
return;
}
@ -66,6 +69,17 @@ report_scripting_error(struct module *module, struct session *ses,
}
#endif
static union option_info scripting_options[] = {
INIT_OPT_TREE("document", N_("Scripting"),
"scripting", OPT_ZERO,
N_("Document scripting options.")),
INIT_OPT_BOOL("document.scripting", N_("Sleep on errors"),
"sleep_on_error", OPT_ZERO, 1,
N_("In case of errors in scripts an error message is shown. If this option is enabled ELinks also sleeps for 3 seconds.")),
NULL_OPTION_INFO,
};
static struct module *scripting_modules[] = {
#ifdef CONFIG_SCRIPTING_LUA
@ -91,7 +105,7 @@ static struct module *scripting_modules[] = {
struct module scripting_module = struct_module(
/* name: */ N_("Scripting"),
/* options: */ NULL,
/* options: */ scripting_options,
/* events: */ NULL,
/* submodules: */ scripting_modules,
/* data: */ NULL,