commit fc42ab9b463acdc7cf61b6b4aeef3dce2dd569e8
parent 7f17777a4ba55b5deddccd52b19edeab677611fa
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 20 May 2023 17:31:05 +0200
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.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -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