bindings: allow speller and friends to be rebound also in restricted mode

Speller, linter, formatter, and execute-a-command cannot be used in
restricted mode, but the relevant keys should report that the function
is *disabled*, not that the key is unbound.

This fixes https://savannah.gnu.org/bugs/?64226.

Problem existed since version 3.2, since nano reads the nanorc files
also in restricted mode.
This commit is contained in:
Benno Schulenberg 2023-05-20 17:31:05 +02:00
parent 7f17777a4b
commit fc42ab9b46

View File

@ -1013,7 +1013,6 @@ void shortcut_init(void)
add_to_funcs(to_next_anchor, MMAIN,
N_("Down to anchor"), WHENHELP(nextanchor_gist), BLANKAFTER);
if (!ISSET(RESTRICTED)) {
#ifdef ENABLE_SPELLER
add_to_funcs(do_spell, MMAIN,
N_("Spell Check"), WHENHELP(spell_gist), TOGETHER);
@ -1026,7 +1025,10 @@ void shortcut_init(void)
add_to_funcs(do_formatter, MMAIN,
N_("Formatter"), WHENHELP(formatter_gist), BLANKAFTER);
#endif
}
/* Although not allowed in restricted mode, keep execution rebindable. */
if (ISSET(RESTRICTED))
add_to_funcs(do_execute, MMAIN,
N_("Execute"), WHENHELP(execute_gist), TOGETHER);
#endif /* !NANO_TINY */
#ifdef NANO_TINY