~vcs-imports/nano/master

« back to all changes in this revision

Viewing changes to src/global.c

  • Committer: Benno Schulenberg
  • Date: 2023-05-21 08:51:37 UTC
  • Revision ID: git-v1:fc42ab9b463acdc7cf61b6b4aeef3dce2dd569e8
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1013
1013
        add_to_funcs(to_next_anchor, MMAIN,
1014
1014
                        N_("Down to anchor"), WHENHELP(nextanchor_gist), BLANKAFTER);
1015
1015
 
1016
 
        if (!ISSET(RESTRICTED)) {
1017
1016
#ifdef ENABLE_SPELLER
1018
1017
                add_to_funcs(do_spell, MMAIN,
1019
1018
                                N_("Spell Check"), WHENHELP(spell_gist), TOGETHER);
1026
1025
                add_to_funcs(do_formatter, MMAIN,
1027
1026
                                N_("Formatter"), WHENHELP(formatter_gist), BLANKAFTER);
1028
1027
#endif
1029
 
        }
 
1028
        /* Although not allowed in restricted mode, keep execution rebindable. */
 
1029
        if (ISSET(RESTRICTED))
 
1030
                add_to_funcs(do_execute, MMAIN,
 
1031
                                N_("Execute"), WHENHELP(execute_gist), TOGETHER);
1030
1032
#endif /* !NANO_TINY */
1031
1033
 
1032
1034
#ifdef NANO_TINY