mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
config: Rearrange mirror-or-not checks.
(cherry picked from commit 72de752f84
)
This commit is contained in:
parent
1841d8f399
commit
bfa41cef38
@ -272,7 +272,15 @@ parse_set(struct option *opt_tree, struct conf_parsing_state *state,
|
|||||||
return ERROR_VALUE;
|
return ERROR_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mirror) {
|
if (!mirror) {
|
||||||
|
/* loading a configuration file */
|
||||||
|
if (!option_types[opt->type].set
|
||||||
|
|| !option_types[opt->type].set(opt, val)) {
|
||||||
|
mem_free(val);
|
||||||
|
return show_parse_error(state, ERROR_VALUE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* rewriting a configuration file */
|
||||||
if (opt->flags & OPT_DELETED)
|
if (opt->flags & OPT_DELETED)
|
||||||
opt->flags &= ~OPT_WATERMARK;
|
opt->flags &= ~OPT_WATERMARK;
|
||||||
else
|
else
|
||||||
@ -281,10 +289,6 @@ parse_set(struct option *opt_tree, struct conf_parsing_state *state,
|
|||||||
option_types[opt->type].write(opt, mirror);
|
option_types[opt->type].write(opt, mirror);
|
||||||
state->mirrored = state->pos.look;
|
state->mirrored = state->pos.look;
|
||||||
}
|
}
|
||||||
} else if (!option_types[opt->type].set
|
|
||||||
|| !option_types[opt->type].set(opt, val)) {
|
|
||||||
mem_free(val);
|
|
||||||
return show_parse_error(state, ERROR_VALUE);
|
|
||||||
}
|
}
|
||||||
/* This is not needed since this will be WATERMARK'd when
|
/* This is not needed since this will be WATERMARK'd when
|
||||||
* saving it. We won't need to save it as touched. */
|
* saving it. We won't need to save it as touched. */
|
||||||
@ -344,9 +348,11 @@ parse_unset(struct option *opt_tree, struct conf_parsing_state *state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mirror) {
|
if (!mirror) {
|
||||||
|
/* loading a configuration file */
|
||||||
if (opt->flags & OPT_ALLOC) delete_option(opt);
|
if (opt->flags & OPT_ALLOC) delete_option(opt);
|
||||||
else mark_option_as_deleted(opt);
|
else mark_option_as_deleted(opt);
|
||||||
} else {
|
} else {
|
||||||
|
/* rewriting a configuration file */
|
||||||
if (opt->flags & OPT_DELETED)
|
if (opt->flags & OPT_DELETED)
|
||||||
opt->flags |= OPT_WATERMARK;
|
opt->flags |= OPT_WATERMARK;
|
||||||
else
|
else
|
||||||
@ -413,8 +419,21 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
|
|||||||
return show_parse_error(state, ERROR_PARSE);
|
return show_parse_error(state, ERROR_PARSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mirror) {
|
if (!mirror) {
|
||||||
/* Mirror what we already have */
|
/* loading a configuration file */
|
||||||
|
/* We don't bother to bind() if -default-keys. */
|
||||||
|
if (!get_cmd_opt_bool("default-keys")
|
||||||
|
&& bind_do(keymap, keystroke, action, is_system_conf)) {
|
||||||
|
/* bind_do() tried but failed. */
|
||||||
|
err = show_parse_error(state, ERROR_VALUE);
|
||||||
|
} else {
|
||||||
|
err = ERROR_NONE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* rewriting a configuration file */
|
||||||
|
/* Mirror what we already have. If the keystroke has
|
||||||
|
* been unbound, then act_str is simply "none" and
|
||||||
|
* this does not require special handling. */
|
||||||
unsigned char *act_str = bind_act(keymap, keystroke);
|
unsigned char *act_str = bind_act(keymap, keystroke);
|
||||||
|
|
||||||
if (act_str) {
|
if (act_str) {
|
||||||
@ -426,15 +445,6 @@ parse_bind(struct option *opt_tree, struct conf_parsing_state *state,
|
|||||||
} else {
|
} else {
|
||||||
err = show_parse_error(state, ERROR_VALUE);
|
err = show_parse_error(state, ERROR_VALUE);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* We don't bother to bind() if -default-keys. */
|
|
||||||
if (!get_cmd_opt_bool("default-keys")
|
|
||||||
&& bind_do(keymap, keystroke, action, is_system_conf)) {
|
|
||||||
/* bind_do() tried but failed. */
|
|
||||||
err = show_parse_error(state, ERROR_VALUE);
|
|
||||||
} else {
|
|
||||||
err = ERROR_NONE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mem_free(keymap); mem_free(keystroke); mem_free(action);
|
mem_free(keymap); mem_free(keystroke); mem_free(action);
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
Reference in New Issue
Block a user